Method and apparatus for pyramid vector quantization indexing and de-indexing of audio/video sample vectors

ABSTRACT

A method for pyramid vector quantization indexing of audio/video signals comprises obtaining of an integer input vector representing the audio/video signal samples. A leading sign is extracted from the integer input vector. The leading sign is a sign of a terminal non-zero coefficient in the integer input vector. The terminal non-zero coefficient is one of a first non-zero coefficient and a last non-zero coefficient in the integer input vector. The integer input vector is indexed with a pyramid vector quantization enumeration scheme into an output index representing the audio/video signal samples. The pyramid vector quantization enumeration scheme is designed for neglecting the sign of the terminal non-zero coefficient. The output index and the leading sign are outputted. A corresponding method for de-indexing, an encoder, a decoder, and computer programs therefore are also disclosed.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.14/434,058, filed Apr. 7, 2015, which itself is a 35 U.S.C. §371national stage application of PCT International Application No.PCT/SE2015/050216, filed Feb. 26, 2015, which itself claims priority toU.S. provisional Application No. 61/945,403, filed Feb. 27, 2014, thedisclosure and content of all of which are incorporated by referenceherein in their entirety.

TECHNICAL FIELD

The proposed technology generally relates to encoding/decoding ofaudio/video signals and in particular to methods and apparatuses forpyramid vector quantization indexing and de-indexing of audio/videosample vectors.

BACKGROUND

When audio or video signals are to be transmitted or stored, the signalsare typically encoded. In an encoder, vectors representing audio/videosignal samples are encoded to be represented by a number of coefficientsor parameters. These coefficients or parameters can then efficiently betransmitted or stored. When the coefficients or parameters are receivedor retrieved, a decoding of the coefficients or parameters intoaudio/video signal samples is performed to retrieve the originalaudio/video signal. Many different kinds of encoding techniques havebeen used for audio/video signals.

One approach is based on vector quantization (VQ). It is known thatunconstrained vector quantization (VQ) is the optimal quantizationmethod for grouped samples (vectors) of a certain length. However, thememory and search complexity constraints have led to the development ofstructured vector quantizers. Different structures gives differenttrade-offs in terms of search complexity and memory requirements. Onesuch method is the gain-shape vector quantization, where the targetvector x is represented using a shape vector vec and a gain G:

${vec} = \frac{x}{G}$

The concept is, instead of quantizing directly the target vector, toquantize pairs of {vec, G}. Gain and shape components are then encodedusing a shape quantizer which is tuned for the normalized shape inputand a gain quantizer which handles the dynamics of the signal. Thisstructure is well used in e.g. audio coding since the division intodynamics and shape (or fine structure) fits well with the perceptualauditory model.

A valid entry in the selected structured vector quantizer, is firstsearched using the knowledge of the structure (e.g. L1(absoluteamplitude)−normalization or L2(energy)−normalization). After a validvector has been found one needs to efficiently create an index (orcodeword) that represents that specific vector and then transmit thatindex to the receiver. The index creation (also known as indexing orenumeration) will use the properties of the selected structure andcreate a unique index (codeword) for the found vector in the structuredVQ.

On the receiving side the decoder needs to efficiently decompose theindex into the same vector that was determined on the encoder side. Thisdecomposition can be made very low complex in terms of operations byusing a large table lookup, but then at the cost of huge storedRead-Only Memory (ROM) tables. Alternatively one can design thedecomposition (also known as de-indexing) so that it uses knowledge ofthe selected structure and potentially also the available targethardware numerical operations to algorithmically decompose the indexinto the unique vector, in an efficient way.

A well designed structured VQ, has a good balance between encoder searchcomplexity, encoder indexing complexity and decoder de-indexingcomplexity in terms of Million Operations Per Second (MOPS) and in termsof Program ROM and dynamic Random Access Memory (RAM) required, and interms of Table ROM.

Many audio codecs such as CELT, IETF/Opus-Audio and ITU-T G.719 use anenvelope and shape VQ and an envelope mixed gain-shape VQ to encode thespectral coefficients of the target audio signal (in the ModifiedDiscrete Cosine Transform (MDCT) domain). CELT/IETF OPUS-Audio use aPVQ-Vector Quantizer, while G.719 uses and slightly extended RE8Algebraic Vector Quantizer for R=1 bit/dimension coding and a very lowcomplexity D8 Lattice quantizer for VQ rates higher than 1bit/dimension. PVQ stands for Pyramid Vector Quantizer, it is a VQ thatuses the L1-norm(Eabs(vector)) to enable a fast search. It has also beenfound that PVQ may provide quite efficient indexing. The PVQ has beenaround for some time, but was initially developed in 1983-86 by Fischer.

PVQ-quantizers have also been used for encoding of time domain andLinear Prediction (LP) residual domain samples in speech coders, and forencoding of frequency domain Discrete Cosine Transform (DCT)coefficients. An advantage with the PVQ compared to other structured VQsis that it naturally can handle any vector dimension, while otherstructured VQs often are limited to the dimension being multiples, e.g.multiples of 4 or multiples of 8.

The IETF/OPUS Codec in Audio mode is employing a recursive PVQ-indexingand de-index scheme that has a maximum size of the PVQ-indices/(short)codewords set to 32 bits. If the target vector to be quantized requiresmore than 32 bits, the original target vector is recursively split inhalves into lower dimensions, until all sub-vectors fit into the 32 bitshort codeword indexing domain. In the course of the recursive binarydimension splitting there is an added cost of adding a codeword forencoding the energy relation (the relative energies, which can berepresented by a quantized angle) between the two split sub targetvectors. In OPUS-Audio the structured PVQ-search is made on theresulting split smaller dimension target sub-vectors.

The original CELT codec (developed by Valin, Terribery and Maxwell in2009), is employing a similar PVQ-indexing/deindexing scheme, (with a 32bit codeword limit) but the binary dimension split in CELT is made inthe indexing domain after searching and after establishing the initialPVQ-structured vector. The integer PVQ-vector to index is thenrecursively reduced to smaller than or equal to 32 bit PVQ-vectorsub-units in the integer domain. This is again achieved by adding anadditional codeword for the split, this time for the integer relationbetween the ‘left’ integer sub-vector and the ‘right’ integersub-vector, so that one can know the L1-norm of each of the subPVQ-vectors in the decoder. The CELT post-search integer indexing splitapproach leads to a variable rate (variable total size index), which canbe a disadvantage if the media-transport requires fixed rate encoding.

In 1997 and 1998 Hung, Tsern and Meng, investigated the error robustnessof a few PVQ-indexing variations, they summarized the PVQ-enumeration(indexing) problem this way (1 is the vector dimension and k is thenumber of unit pulses):

“Enumeration assigns a unique index to all possible vectors in thePVQ-codebook, P(l, k), imparting a sorting order to the PVQ-codebookvectors.” “Systematic sorting for enumeration is done through countingformulas for the number of vectors in the pyramid; this is a commonconcept to all pyramid enumeration techniques.”

“The number of vectors in the pyramid codebook P(l, k) is denoted N(l,k). This is related to a binary codeword index length which is ceil(log2(N(l, k))) bits. N(l, k) can be viewed as the number of ways 1 integervalues in a vector can have an absolute sum of k.”

Hung et al, studied the bit error robustness of the PVQ-codewords for acouple of variations of PVQ-indexing/enumeration schemes, but they didnot focus the study on making the implementation of PVQ-enumerationefficient and of sufficiently low complex for an actual hardwareimplementation. The CELT and the IETF/OPUS-Audio PVQ-implementations ofPVQ-indexing are strongly focused on providing an as low complexenumeration as possible (both encoding and decoding), given a 32 bitunsigned integer based hardware, but disregarding the PVQ-sensitivity tobit errors. Also in 1999 Ashley proposed a way to reduce the complexityfor implementing the product code PVQ-enumeration by the use of a lowcomplexity deterministic approximation of the Binomial combinatorialfunction used for size calculation and offset calculation, Ashley et alcall this technique Factorial Pulse Coding (FPC), and it has beenemployed in the ITU-G.718 speech codec standard.

In CELT and IETF/OPUS-Audio, the PVQ-codeword is not limited by thegranularity of a single bit. The two codecs use a higher granularityscheme, using eighth (⅛) bits resolution. This is achieved by using anarithmetic encoder/decoder as an intermediate step in the interface tothe transport bit stream, (CELT/OPUS-Audio uses an implementation of arange encoder/decoder as the arithmetic encoder/decoder) where thenumber of bits used by the PVQ-codeword can be made into fractionalbits. With a bit resolution BITRES=8 (eighths), the fractional PVQcodeword length becomes ceil(log 2(N(l, k)*BITRES))/BITRES. Forinstance, if 1=64, k=5 and BITRES=8, this leads to thatNPVQ=N(l,k)=286680704, log 2(NPVQ)=28.0948696, and ceil(log2(NPVQ)*BITRES)/BITRES=28.125 bits. By using fractional bits there willbe much less truncation loss for many of the N(l, k) PVQ codeword sizes,and especially when a codec is using many calls/instances of aPVQ-quantizer, this will increases the codec's efficiency.

One general issue with structured vector quantization is to find asuitable overall compromise including the methods for efficient search,efficient codeword indexing and efficient codeword de-indexing.

Long index codewords (e.g. a 400 bit integer codeword) gives largercomplexity overhead in indexing and deindexing calculations (and specialsoftware routines will be needed for multiplying and dividing theselarge integers in the long codeword composition and decomposition).

Short index code words can use efficient hardware operators (e.g. SingleInstruction Multiple Data (SIMD) instructions in a 32 bit Digital SignalProcessor (DSP)), however at the cost of requiring pre-splitting of thetarget VQ-vectors (like in IETF/OPUS-Audio), or post-search-splittingthe integer PVQ-search result-vector (like in original-CELT). Thesedimension splitting methods adds a transmission cost for the splittinginformation codeword (splitting overhead), and the shorter the possibleindex-codewords are, the higher number of splits are required and theresult is an increased overhead for the long index codeword splitting.E.g. 16 bit short PVQ-codewords will result in many more splits than 32bit short codewords, and thus a higher overhead for the splitting.

The PVQ (Pyramid Vector Quantizer) readily allows for a very efficientsearch, through L1-normalization. Typically the absolute sum normalizedtarget vector is created, followed by vector value truncation (orrounding) and then a limited set of corrective iterations are run toreach the target L1-norm (k) for the PVQ-vector (PVQ-vec).

The problem of the previously mentioned CELT/OPUS prior art shortcodeword indexing schemes is that they are limited to a 32-bit integerrange (unsigned 32-bit integers), and further they cannot be efficientlyimplemented in a DSP-architecture that only supports fast instructionsfor signed 32-bit integers.

SUMMARY

It is an object of the here presented technology to expand the size ofthe vectors indexed by PVQ that can be processed in a hardware having anoptimum operation bit size.

This and other objects are met by embodiments of the proposedtechnology.

According to a first aspect, there is provided a method for pyramidvector quantization indexing of audio/video signals. The methodcomprises obtaining of an integer input vector, which integer inputvector representing audio/video signal samples, which integer inputvector having a number of integer-valued coefficients, extracting of aleading sign from said integer input vector, which leading sign is asign of a terminal non-zero coefficient in the integer input vector,which terminal non-zero coefficient is one of a first non-zerocoefficient and a last non-zero coefficient in the integer input vector,indexing the integer input vector with a pyramid vector quantizationenumeration scheme into an output index, which output index togetherwith the leading sign representing the audio/video signal samples,wherein the pyramid vector quantization enumeration scheme is designedfor neglecting the sign of the terminal non-zero coefficient, andoutputting of the output index as a first codeword and the leading signas a second codeword into an outgoing bit stream.

In one embodiment, the extracting takes place before the enumerating. Inanother embodiment, extracting takes place concurrently and incooperation with the enumerating. In one embodiment, an offsetparameter, in this disclosure denoted as U(n,k), is defined as thenumber of integer vectors of dimension n and L1-norm of k, that does nothave a leading zero, and does not have the leading value k, has aleading positive value, and has a positive next leading sign. The offsetparameter U is in that embodiment used for calculation of the indexingscheme used in the enumeration. In another embodiment, the indexcalculation is dependent on both the U parameter and an offsetparameter, in this disclosure denoted as A(n,k), being defined as thenumber of integer vectors of dimension n and L1-norm of k, that has apositive leading value and that does not have a leading zero. In yetanother embodiment, index calculation in the enumeration is dependentpartly on the enumeration procedures based on U or a combination of Uand A. In other words, the enumeration may employ an initialMPVQ-leading sign enumeration stage followed by any other efficientPVQ-enumeration scheme, for the remainder of the vector.

According to a second aspect, there is provided a method for pyramidvector quantization deindexing of audio/video signals. The methodcomprises receiving, from an ingoing bit stream, of a leading sign as afirst codeword and an input index as a second codeword, the leading signand the input index representing audio/video signal samples, whichleading sign is a sign of a terminal non-zero coefficient in an integeroutput vector to be created, representing the audio/video signalsamples, which integer output vector having a number of integer-valuedcoefficients, which terminal non-zero coefficient is one of a firstnon-zero coefficient and a last non-zero coefficient in the integeroutput vector, deindexing of the input index into the integer outputvector according to a pyramid vector quantization de-enumeration scheme,wherein the input index being created by an enumeration scheme isdesigned for neglecting the sign of the terminal non-zero coefficient,assigning of a sign of the terminal non-zero coefficient in the integeroutput vector according to the received leading sign, and outputting ofthe integer output vector.

According to a third aspect, there is provided a method forcommunication of audio/video signals. The method comprises encoding theaudio/video samples, in an encoder of a transmitter, according to amethod according to the first aspect, transmission of the output indexand the leading sign from the transmitter to a receiver, where it isreceived as an input index and a leading sign, and decoding, in adecoder in the receiver, said input index and said leading signaccording to a method according to the second aspect.

According to a fourth aspect, there is provided an encoder for indexingof audio/video signals by pyramid vector quantization. The encoder isoperative to obtain an integer input vector, which integer input vectorrepresenting the audio/video signal samples, which integer input vectorhaving a number of integer-valued coefficients, extract a leading signfrom the integer input vector, which leading sign is a sign of aterminal non-zero coefficient in the integer input vector, whichterminal non-zero coefficient is one of a first non-zero coefficient anda last non-zero coefficient in the integer input vector, index theinteger input vector with a pyramid vector quantization enumerationscheme into an output index, which output index together with theleading sign representing the audio/video signal samples, wherein thepyramid vector quantization enumeration scheme is designed forneglecting the sign of the terminal non-zero coefficient, and to outputthe leading sign as a first codeword and the output index as a secondcodeword into an outgoing bit stream.

According to a fifth aspect, there is provided a decoder for deindexingof audio/video signals by pyramid vector quantization. The decoder isoperative to receive, from an ingoing bit stream, a leading sign as afirst codeword and an input index as a second codeword, the leading signand the input index representing audio/video signal samples, whichleading sign is a sign of a terminal non-zero coefficient in an integeroutput vector to be created, representing the audio/video signalsamples, which integer output vector having a number of integer-valuedcoefficients, which terminal non-zero coefficient is one of a firstnon-zero coefficient and a last non-zero coefficient in the integeroutput vector, deindex the input index into a the integer output vectoraccording to a pyramid vector quantization de-enumeration scheme,wherein the input index being created by an enumeration scheme isdesigned for neglecting the sign of the terminal non-zero coefficient,assign a sign of the terminating non-zero coefficient according to thereceived leading sign, and to output the integer output vector.

According to a sixth aspect, there is provided an encoder for pyramidvector quantization indexing of audio/video signal samples. The encodercomprises an input module for obtaining an integer input vector, whichinteger input vector representing the audio/video signal samples, whichinteger input vector having a number of integer-valued coefficients. Theencoder further comprises an extracting module for extracting a leadingsign from the integer input vector. The leading sign is a sign of aterminal non-zero coefficient in the integer input vector. The terminalnon-zero coefficient is one of a first non-zero coefficient and a lastnon-zero coefficient in the integer input vector. The encoder furthercomprises an indexing module for indexing the integer input vector witha pyramid vector quantization enumeration scheme into an output index,which output index together with the leading sign representing theaudio/video signal samples, wherein the pyramid vector quantizationenumeration scheme is designed for neglecting the sign of the terminalnon-zero coefficient. The encoder further comprises an output module foroutputting the leading sign as a first codeword and the output index asa second codeword into an outgoing bit stream.

According to a seventh aspect, there is provided a decoder for decodingof audio/video signal samples. The decoder comprises a receiver forreceiving a leading sign as a first codeword and an input index as asecond codeword from an ingoing bit stream. The leading sign and theinput index representing audio/video signal samples. The leading sign isa sign of a terminal non-zero coefficient in an integer output vector tobe created, representing the audio/video signal samples. The integeroutput vector has a number of integer-valued coefficients. The terminalnon-zero coefficient is one of a first non-zero coefficient and a lastnon-zero coefficient in the integer output vector. The decoder furthercomprises a deindexing module for deindexing the input index into theinteger output vector according to a pyramid vector quantizationde-enumeration scheme, wherein the input index being created by anenumeration scheme is designed for neglecting the sign of the terminalnon-zero coefficient. The decoder further comprises an assigning modulefor assigning a sign of the terminal non-zero coefficient in the integeroutput vector according to the received leading sign. The decoderfurther comprises an output module for outputting the integer outputvector.

According to an eighth aspect, there is provided a network nodecomprising an encoder according to the fourth or sixth aspect and/or adecoder according to the fifth or seventh aspect.

According to a ninth aspect, there is provided a user equipmentcomprising an encoder according to the fourth or sixth aspect and/or adecoder according to the fifth or seventh aspect.

According to a tenth aspect, there is provided a computer program forencoding of audio/video signal samples, which computer program comprisesinstructions, which when executed by at least one processor, cause theprocessor(s) to obtain an integer input vector, which integer inputvector represents the audio/video signal samples. The integer inputvector has a number of integer-valued coefficients. The computer programcomprises further instructions, which when executed by the processor(s),cause the processor(s) to extract a leading sign from the integer inputvector. The leading sign is a sign of a terminal non-zero coefficient inthe integer input vector. The terminal non-zero coefficient is one of afirst non-zero coefficient and a last non-zero coefficient in theinteger input vector. The computer program comprises furtherinstructions, which when executed by the processor(s), cause theprocessor(s) to index the integer input vector with a pyramid vectorquantization enumeration scheme into an output index, which output indextogether with said leading sign representing the audio/video signalsamples. The pyramid vector quantization enumeration scheme is designedfor neglecting the sign of said terminal non-zero coefficient. Thecomputer program comprises further instructions, which when executed bythe processor(s), cause the processor(s) to output the leading sign as afirst codeword and the output index as a second codeword into anoutgoing bit stream.

According to an eleventh aspect, there is provided a computer programfor decoding of audio/video signals, which computer program comprisesinstructions, which when executed by at least one processor, cause theprocessor(s) to receive a leading sign as a first codeword and an inputindex as a second codeword from an ingoing bit stream. The leading signand the input index representing audio/video signal samples. The leadingsign is a sign of a terminal non-zero coefficient in an integer outputvector to be created, representing the audio/video signal samples. Theinteger output vector has a number of integer-valued coefficients. Theterminal non-zero coefficient is one of a first non-zero coefficient anda last non-zero coefficient in said integer output vector. The computerprogram comprises further instructions, which when executed by theprocessor(s), cause the processor(s) to deindex the input index into theinteger output vector with a pyramid vector quantization de-enumerationscheme. The input index being created by an enumeration scheme isdesigned for neglecting the sign of the terminal non-zero coefficient.The computer program comprises further instructions, which when executedby the processor(s), cause the processor(s) to assign a sign of theterminating non-zero coefficient according to the received leading sign.The computer program comprises further instructions, which when executedby the processor(s), cause the processor(s) to output the integer outputvector.

According to a twelfth aspect, there is provided a carrier comprisingthe computer program of at least one of the tenth and eleventh aspect.The carrier is one of an electronic signal, an optical signal, anelectromagnetic signal, a magnetic signal, an electric signal, a radiosignal, a microwave signal, or a computer-readable storage medium.

One advantage with the here presented techniques is that it reduces thedynamic range necessary for the required indexing offsets, therebyreducing the demands on the accepted bit size of the used hardware.

The indexing algorithm preferably iteratively decomposes thePVQ-structure and indices into leading sign sections. The decompositionis made in such a way that independently of the number of non-zeroelements in the found PVQ-vector to index, always one leading sign isextracted. This low complex sign extraction further enables the creationof a reduced dynamic range for runtime calculated PVQ indexing offsets.

As one particular example, the improved indexing and de-indexingalgorithms will enable the use of 33 bit PVQ-indices in 32-bit DSPHardware, with marginal additional cost in terms of overall MOPS, RAM,ROM and Program Read-Only Memory (P-ROM). Further the algorithm willenable the use of 32-bit PVQ-indices in a DSP Hardware only supportingsigned 32 bit arithmetic.

Other advantages will be appreciated when reading the detaileddescription.

BRIEF DESCRIPTION OF THE DRAWINGS

The embodiments, together with further objects and advantages thereof,may best be understood by making reference to the following descriptiontaken together with the accompanying drawings, in which:

FIG. 1 is a schematic illustration of an example audio coding system;

FIG. 2 is a schematic block diagram of an embodiment of an encoder;

FIG. 3 is a schematic block diagram of an embodiment of a decoder;

FIG. 4 is a tabled structure view of an embodiment of an offset and itsrelation to the total number of vectors in the structure;

FIG. 5 is a flow diagram of steps of an embodiment of a method forpyramid vector quantization indexing of audio/video samples;

FIG. 6 is a flow diagram of steps of an embodiment of a MPVQ indexing ona general level;

FIG. 7A-B is a flow diagram of steps of an embodiment of a method forMPVQ-index composition;

FIG. 8 is a tabled high level structure view of an embodiment of a basicMPVQ iteration;

FIG. 9 is a flow diagram of steps of a combination of three embodimentsof a MPVQ-A/U offset recursion for increasing dimension;

FIG. 10 illustrates a flow diagram of steps of an embodiment of a methodfor pyramid vector quantization deindexing of audio/video samples;

FIG. 11 is a flow diagram of steps of an embodiment of MPVQ deindexing;

FIG. 12 is a flow diagram of steps of an embodiment of procedures tofind size and offsets;

FIG. 13 is a flow diagram of steps of an embodiment of MPVQ indexdecomposition;

FIG. 14 is a flow diagram of steps of an embodiment for finding anamplitude of a next coefficient;

FIG. 15 is a flow diagram of steps of an embodiment of a procedure forfinding the next leading sign and removing the extracted signinformation;

FIG. 16 is a flow diagram of steps of an embodiment of a procedure foroffset updating for one dimension less;

FIG. 17A is a diagram presenting an overview of PVQ-codewords for somecommon hardware bit limits;

FIG. 17B is a diagram presenting an overview of the related R values inbits/sample for optimal PVQ-codeword quantizers with different BITlimits;

FIG. 17C is a diagram showing a corresponding achievable pulse density,which is directly correlated to the resulting shape matching capabilityof the PVQ;

FIG. 17D is a diagram illustrating a worst case MOPS Instructiontrade-off in indexing/deindexing for a sample prior art scheme PVQ andfor the new scheme MPVQ;

FIG. 18 is a flow diagram of steps of an embodiment of a MPVQ-indexcomposition using pre-extracted leading signs;

FIG. 19 is a flow diagram of steps of an embodiment of a sign extractionfunction;

FIG. 20 illustrates schematically an embodiment of an encoder;

FIG. 21 illustrates schematically an embodiment of a decoder;

FIG. 22 illustrates schematically an embodiment of an encoder;

FIG. 23 illustrates schematically an embodiment of a decoder; and

FIG. 24 illustrates an example of sign pre-shifting that utilizes N=8and K=13.

DETAILED DESCRIPTION

The embodiments, together with further objects and advantages thereof,may best be understood by making reference to the following descriptiontaken together with the accompanying drawings.

Throughout the drawings, the same reference designations are used forsimilar or corresponding elements.

The indexing algorithm iteratively decomposes the PVQ-structure andindices into leading sign sections. The decomposition is made in such away that independently of the number of non-zero elements in the foundPVQ-vector to index, always one leading sign is extracted. This lowcomplex sign extraction further enables the creation of a reduceddynamic range for runtime calculated PVQ indexing offsets.

The PVQ indexing offsets are used in PVQ-index composition and in thePVQ-index decomposition. As the structured PVQ-quantizer intrinsicallycan handle a large variation in dimension (l) and unit pulses (k), andthus in bit rate, the offsets are usually only calculated for thecurrent dimension to be encoded and the current number of unit pulses.The bit rate corresponds to log 2(N_(PVQ)(l,k), resulting in a hugeamount of possible PVQ offsets. The offsets are stored in a dynamic RAM.However, an l,k-limited PVQ quantizer implementation may use tablelookup to store the indexing/de-indexing offsets.

For a better understanding of the proposed technology, it may be usefulto refer to extracts of IETF/OPUS search/indexing/de-indexing prior artdescription, collected in Appendix A.

In FIG. 1, an example audio coding system using the scheme presented inthe present description is illustrated. This is an example audio codecsystem with an encoder 10 and a decoder 60 using MPVQ indexing andde-indexing. The first part corresponds to the parts comprised in anencoder 10 and the second part of the figure corresponds to the partscomprised in a decoder 60. An input sample 1 is provided to the encoder10. The encoder 10 provides a bit stream 2 representing the input vectoras at least a MPVQ index and a leading sign. A bit stream 2′, preferablyessentially equal to the bit stream 2 from the encoder 10, is providedto the decoder 60, where the decoder decodes the MPVQ index and theleading sign to a reconstructed sample 3. Typically, the MPVQ index andthe leading sign are provided as separate codewords.

An embodiment of an encoder 10 is illustrated in more detail in FIG. 2.The input sample 1, representing an audio/video sample x is received. Ina norm calculator 12, a norm factor g is computed. A norm quantizer 14creates norm quantization bits NORMQ-bits representing the norm of theinput vector. These bits are typically provided to be included in theBit stream. The input vector is normalized by the norm factor into anormalized vector 4. The norm quantizer 14 also optionally provided thenorm factor, e.g. as NORMQ-bits, to a bit allocation section 16, whichcalculates, or retrieves from look-up tables, suitable values of N andK, i.e. the dimension of the integer vector and the total number of unitpulses. These values may optionally be provided in the outgoingbit-stream or be derived at the receiving side from preceding parametersin the bit stream. A PVQ shape search section 18 converts the normalizedvector 4 into an integer input vector 5 for PVQ. The integer inputvector is provided to a MPVQ-indexing section 20, where the actual MPVQindexing takes place. This will be discussed more in detail furtherbelow. A leading sign 15, as a first codeword, and an output index, as asecond codeword, an MPVQ index 25, typically accompanied by the MPVQsize are output from the MPVQ-indexing section 20 to a bit streammultiplexor, MUX, 30. There, the different information quantities aremerged into a single bit stream 2, being output from the bit stream MUX30.

An embodiment of a decoder 60 is illustrated in more detail in FIG. 3.An incoming bit stream 2′ is provided to a bit stream DEMUX 80. Here thedifferent parts of the information is divided into parts. Informationsupporting the bit allocation, such as N and K values or NORMQ-bits, isprovided to a bit allocation section 62, outputting relevant values of Nand K to a size/offsets calculation section 64 and a MPVQ-deindexingsection 70. The size/offsets calculation section 64 calculates offsets8, based on the N and K values as well as the MPVQ size obtained fromthe information 25′ of reconstructed MPVQ index 25′, typicallyaccompanied by the MPVQ size, and provided to the MPVQ deindexingsection 70. The reconstructed MPVQ index 25′, as a second codeword, andthe reconstructed leading sign 15′, as a first codeword, are alsoprovided to the MPVQ deindexing section 70, where the actual MPVQdeindexing takes place. This will be discussed more in detail furtherbelow. An integer output vector 6′, being a reconstruction of theinteger input vector in the encoder, is output to a unit energynormalization section 68 in which the normalization is secured. A normde-quantizer 66 uses the NORMQ-bits to provide a norm factor {circumflexover (q)}. The norm factor is then used to form the final output vector2 being a reconstructed sample 3 of the original audio/video sample.

It should be noted that the MPVQ-scheme is not limited to the particularsystem in the FIGS. 2 and 3, but can also be employed for indexing ofany PVQ-based quantization system, e.g. time domain signals in a LinearPredictive (LP) Vocoder or transform domain coefficients in a videocodec.

For instance, in FIGS. 2 and 3 the “BITSTREAM MUX” and “BITSTREAM DEMUX”blocks may optionally employ an arithmetic encoder and decoderrespectively, to limit the PVQ-index truncation loss as explainedelsewhere in the present disclosure. The “MUX” and “DEMUX” blocks needto know the integer size (MPVQ-size) of each short PVQ-codeword, to beable to extract the right number of bits for the MPVQ(n,k) codeword.Without an arithmetic encoder/decoder the MUX/DEMUX will use ceil(log2(MPVQ-size)) whole non-fractional bits when parsing the bit-stream forthe MPVQ(n, k) short codeword. With an arithmetic encoder/decoder pair,the bit resolution and distribution function(s) employed by thearithmetic encoder/decoder pair will decide the fractional bits used bythe “MUX” and “DEMUX blocks”. The arithmetic encoder/decoder pair willalso need the integer MPVQ-size to determine how it should parse bits(now fractional) decoded from the bit-stream.

Such operations are well known by anyone skilled in the art and are inthe remaining description assumed to be a natural part of a PVQ system.

In FIG. 2, in the encoder the MPVQ-size is calculated as a part of theMPVQ-indexing loop and then provided to the MUX. In FIG. 3, the decoder,a function calculating MPVQ-offsets and MPVQ-size is called first, thenthe codeword is extracted from the MUX using this integer sizeinformation. The extracted index (second codeword) and the initialoffsets are then provided to the MPVQ-deindexing block.

The encoder part and/or the decoder part of FIGS. 2 and 3 may in someapplications be comprised in a node of a communication network, or aUser Equipment. The node of the communication network may e.g. be aradio network node, e.g. a base station. The communication between theencoder part and the decoder part can be performed by wired and/orwireless transmission. The encoder part and the decoder part may alsooperate separately. For instance, the encoder part could be a part of arecording equipment, and the resulting bitstream could be stored for afuture use. Likewise, the decoder part could be a part of a playingequipment, which for instance retrieves a bitstream from a storage anddecode it into audio/video signals.

One embodiment of an MPVQ enumeration method is using an inventivecombined magnitude and single leading sign bit based enumeration,N_(PVQ)(l,k)=2*N_(MPVQ)(l,k), where the MPVQ scheme preferably is usingan iterative additive magnitude enumeration, further preferably based onan established leading sign of the first non-zero element in theremaining vector.

The prior art, IETF/OPUS-codec is using an optimized version of theoriginal Fischer enumeration, with improved row-by-row, direct rowoffset calculation recursions, fast exact-integer division throughwrapping multiplication, and also direct non-recursive equation offsetand size calculations (if dimension 1 and the number of unit pulses k,are low enough to allow for such direct calculations). See Appendix Afor RFC-text description extracts of the IETF/OPUS-AudioPVQ-implementation and OPUS-c-code references. To reduce theimplementation complexity in OPUS, the maximum index values for a PVQcodeword is restricted to 2³²−1 (an index value that can be representedin unsigned 32 bit integer arithmetic, which is a typical format formany desktop computers).

In a first part of the presently presented technology a leading signModular PVQ (MPVQ) enumeration using a leading sign approach isdescribed. This new improved MPVQ enumeration is using the same generaltechniques (e.g. row-by-row, direct row offset calculation recursions,exact integer division, and direct non-recursive equation offset andsize calculations), but by employing another recursion scheme. Thedynamics of the offset, and size calculation are reduced, enabling anefficient implementation of short PVQ-codeword indexing, with double thesize (1 bit more) of the number of entries in a codeword that can beindexed and de-indexed efficiently.

This indexing/de-indexing improvement seeks in a particular example toenable a low complexity assignment procedure for 33 bit indices,extending the largest possible PVQ that can be used by 1 bit (oralternatively keep it at 1+31 bits, by modifying the enumeration so thatone can use signed arithmetic for a 32 bit spanning PVQ).

Define an offset parameter U(n,k) as the number of integer vectors ofdimension n and L1-norm of k, that does not have a leading zero, anddoes not have the leading value k, has a leading positive value, and hasa positive leading sign. The leading sign is the first sign encounteredafter the current value in the direction of the recursion.

Define an offset parameter A(n,k), as the number of integer vectors ofdimension n and L1-norm of k, that has a positive leading value and thatdoes not have a leading zero.

It then follows that A(n,k)=1+2*U(n,k). The “1” comes from the singleinitial-“k” valued vector, and the factor “2” is due to positive andnegative sign possibility of the next leading sign. A(n, k) is alsoequal to the (N_(PVQ)(n,k−1)+N_(PVQ)(n−1,k−1))/2, a sum which have beenused as an indexing offset in prior art.

See FIG. 4 for a tabled structured view of U(n,k) and its relation tothe total number of vectors in the MPVQ(n, k) structure with N_(MPVQ)(n,k) vectors. The figure illustrates a high level schematic view of anembodiment of a basic MPVQ-iteration including the preferred LeastSignificant Bit (LSB) leading sign enumeration variation, using LSBfirst “interleaving” of the next leading sign information. In apreferred solution the leading sign interleaving is performed for eachpos[0] unique amplitude k_delta, e.g. k_delta=k−1 or k−2 block. Forpos[0] value=“k”, all unit pulses are consumed in pos[0] and theiteration can stop. For pos[0] value being non-zero, positive ornegative next leading sign, the first encountered non-zero position signrequires 1 bit of information. This is stored as the LSB bit in thealways even sized “2*U(n−k)” subsection. For pos[0] value=“k”, iterationis extended to pos[0] without any new leading sign info.

The basic indexing/enumeration approach of this first part is describedin the following. The PVQ vector to index/enumerate is known to be inthe range [0 . . . 2^(B+1)−1] and fits into B+1 bits. Here, B=32 bits istypical for current DSP hardware. For instance if one has PVQ(N,K), i.e.dimension N, K unit pulses, the number of indices N_(PVQ)<=(2^(B+1)−1).

FIG. 5 illustrates a flow diagram of steps of an embodiment of a methodfor pyramid vector quantization indexing of audio/video samples. Themethod starts in step 400. In step 402, an integer input vectorrepresenting the audio/video signal samples is obtained. The integerinput vector has a number of integer-valued coefficients. In step 404, aleading sign is extracted from the integer input vector. The leadingsign is a sign of a terminal non-zero coefficient in the integer inputvector. The terminal non-zero coefficient is one of a first non-zerocoefficient and a last non-zero coefficient in the integer input vector.In step 406, the integer input vector is indexed with a pyramid vectorquantization enumeration scheme into an output index, which output indextogether with the leading sign representing the audio/video signalsamples. The pyramid vector quantization enumeration scheme is designedto neglect the sign of said terminal non-zero coefficient. Inalternative embodiments, step 406 can be performed concurrently as, incombination with or before step 404. In step 408, the leading sign andthe output index are outputted as a first codeword and a secondcodeword, respectively, into an outgoing bit stream. The procedure endsin step 449.

In a particular embodiment, the step of indexing 406 is performed by aniterative enumeration procedure. In a further particular embodiment, theiterative enumeration procedure comprises repetition of an iterationstep, in which one current coefficient of the integer input vector isselected for consideration. The iteration step in turn comprises findingof an offset parameter that is associated with all coefficients of saidinteger input vector processed prior to the current coefficient of theinteger input vector and increasing of an accumulated index independence of the offset parameter. The repetition is continued withcoefficients of the integer input vector being selected one after theother as the current coefficient at least until all coefficients in theinteger input vector has been considered. The iterative enumerationprocedure comprises a terminating step in which the output index is setequal to the accumulated index after all iteration steps have beenended.

FIG. 6 illustrates an embodiment of a MPVQ indexing on a general level.Detailed block diagrams implementing the sending side aspects ofMPVQ-indexing are following below. The MPVQ indexing process starts instep 200, in step 210, the VQ dimension N and number of unit pulses K isachieved from the codec bit allocation loop. In step 220, the PVQ vector“PVQ-vec” is achieved from the PVQ search. In step 230, the MPVQ indexis composed by finding the leading sign bit and MPVQ size. The leadingsign is in step 240 sent to the bit stream and the index is in step 245sent to the bit stream. The procedure is exited in step 249.

In comparison with the flow diagram of FIG. 5, steps 210 and 220 can beconsidered as being comprised in the step 402. Steps 404 and 406 aresimilarly considered to be comprised in step 230. Finally, the steps 240and 250 are considered to be comprised in step 408.

FIG. 7A-B illustrate an embodiment of MPVQ-index composition, and ise.g. provided as step 230 of FIG. 6. In FIG. 7A-B, the composition ofthe MPVQ index and the finding of the leading sign and MPVQ size startsin step 300. This embodiment is based on a solution with a next sign ofthe vector in a LSB position. In step 302, the process is initialized bya known offset iteration base case. In step 304, the current positionparameter is set. The indexing is in this embodiment run from the end ofthe vector towards the beginning. The indexing is run in reverseposition order compared to deindexing, see further below. This meansthat when increasing the accumulated index in each iteration step ascaused by a leading sign, the accumulated index is given a leastsignificant bit in dependence of a previous leading sign in the integerinput vector.

In alternative embodiments, the vector position order can be changedbetween the indexing and de-indexing.

In step 306, an accumulated index is initiated to zero. The parameterk_acc denotes the accumulated unit pulses that are analyzed, and isinitiated to zero. The flag got_sign_flag, indicating whether or not asign is extracted, and is initially also set to zero. In step 308, acurrent coefficient “vec(pos)” from the vector is considered as aparameter “val”. In step 310, if a first sign has been found and thecurrent coefficient is not equal to zero, the process continues to step312, otherwise, the process continues directly to step 314. In step 312,a saved leading sign information from a previous step is put in a LSB. Anegative sign in a previous step corresponds to the valuenext_sign_ind=1 and a positive sign corresponds to the valuenext_sign_ind=0. In step 314, the search for the present sign begins. Ifthe value is equal to zero, no new sign is present and the last signshould be forwarded, which means that the process continues directly tostep 324 (of FIG. 7B). If the current coefficient is not zero, first theflag that a sign has been found is set in step 316. This is really onlynecessary for the first sign, but in the present embodiment, to simplifythe flow, the flag is set every time a non-zero value is found. In step318, the next_sign_ind, i.e. the indicator of the next sign is set toindicate a positive sign. In step 320, it is checked whether the valueof the current coefficient really is positive. If it is found to be likethat, the flow continues to step 324, otherwise, the next_sign_ind, i.e.the indicator of the next sign is changed to indicate a negative sign.

In step 324, the accumulated index is increased in accordance with anoffset value based on the present dimension n and the accumulated unitpulses that are analyzed. In other words, the accumulated index iscounted up a number that corresponds to the number of integer vectors ofdimension n and L1-norm of k_acc, that has a positive leading value andthat does not have a leading zero. In the present embodiment, the Aoffset is used for modification of the accumulated index. As will bediscussed further below, in other embodiments, the U offset can be usedinstead, or a combination of A and U offsets can be used. In step 326,the k_acc parameter is then updated by adding the value of currentcoefficient. If not all positions in the vector has been considered,i.e. the parameter “pos” is larger than zero, and a next repetition isprepared. In step 330, the dimension is increased, and the offsets areupdated, as will be discussed more in detail further below. In step 332,the position of the current coefficient is reduced one step. The processthen returns to step 308 (FIG. 7A) for another repetition with a newcurrent coefficient from the integer input vector to be considered.

If all positions in the vector has been considered, the flow continuesto step 334, where the leading sign is set equal to the current nextsign indication. In other words, the very first sign in the vector hasnot been included in the accumulated index and is extracted as aseparate parameter which do not influence the rest of the indexing. Thismeans that the pyramid vector quantization enumeration scheme that isused neglects the sign of the first non-zero coefficient. Instead, thissign is “pushed” out from the indexing process and is denoted as the“leading sign” or “lead_sign”. The other signs are typically alsoextracted during the iteration but will also influence the indexaccumulation. Finally in step 336, the MPVQ size is calculated, which inthe present embodiment can be performed in two different ways. Theaccumulated index is exiting this procedure as the output index of theMPVQ pyramid vector quantization enumeration scheme. The procedure endsin step 349.

The above structure operates to shift all the signs of the non-zerovector values to be coded one step, to the next, in a selecteddirection, non-zero coefficient. If there is no next position, i.e. theprocess is outside the original vector, store that sign as the remaininglead_sign. This sign shifting can be done as a separate preprocessingstep, as can be seen further below, or in a preferred embodiment insidethe overall dimension iteration loop, as above. The lead_sign (+1 or −1)can now be transmitted as a separate bit in the bit stream, aslead_sign_ind (0 or 1).

The remaining shifted signs and the amplitudes of the original vectorare encoded with a modified indexing/enumeration scheme that use thefact that always exactly one sign has been extracted/shifted out fromthe original PVQ-vector. This extraction is independent of the number ofnon-zero elements in the original PVQ-target vector PVQ-vec.

Three examples are described here below, in order to support theunderstanding of the structure of FIGS. 7A and 7B. The examples are ofan extremely low complexity in order to keep the description limited andto make the total example perceivable. However, in typical realexamples, the dimensions and the number of unit pulses are far higher.The principles are however the same.

In a first example, having a dimension N=3 and number of unit pulsesK=5, consider an integer input vector of [2,2,−1]. The initializing isperformed and “pos” is set to “2”, index, k_acc to “0”, dimension n=1,and the got_sign_flag is unset (=0). The first value “val” is selectedas coefficient 2 of the vector, i.e. −1. (The coefficients of the vectorare numbered: 0, 1, and 2.) Since no non-zero value has been evaluatedyet, no sign has been extracted, and the flow skips the adjustment ofthe index based on detected signs. The flow thereby passes directly tothe evaluation of the value “val”, which is not identical to zero. Thistrigs the sign flag to be set. A first sign has been detected, andnext_sign_ind is set according to the detected sign, in this casenext_sign_ind=1, i.e. a negative value (−1). The accumulated index isthen counted up by an offset A(1,0), which corresponds to the number ofinteger vectors of dimension 1 and L1-norm of 0, that has a positiveleading value and that does not have a leading zero. A(1,0) is equal to0. The accumulated index is now index=0. The accumulated k-parameterk_acc is then updated by the absolute value of “val”, i.e. by 1 unit,i.e. k_acc=1.

A next repetition is prepared by increasing the number n by 1, i.e. n=2,and decreasing the position indicator “pos” by 1, e.g. pos=1. The flowreturns to step 308 and a new value of position 1 is selected, i.e.val=vec(1)=2 in our example. The sign flag “got_sign_flag” indicatesthat a sign is detected and since the present value “val” is not equalto zero, the “next_sign_ind” is added to the accumulated index “index”as a LSB, giving an accumulated index of 1 (=2*0+1). The flow continuesto the evaluation of the value “val”, which is again not identical tozero. The next_sign_ind is set according to the detected sign, in thiscase next_sign_ind=0, i.e. a positive value (2). The accumulated indexis then counted up by an offset A(2,1), which corresponds to the numberof integer vectors of dimension 2 and L1-norm of 1, that has a positiveleading value and that does not have a leading zero. A(2,1) is equalto 1. The accumulated index is now index=2. The accumulated k-parameterk_acc is then updated by the absolute value of vec(1), i.e. by 2 units,i.e. k_acc=3.

A next repetition is prepared by increasing the number n by 1, i.e. n=3,and decreasing the position indicator “pos” by 1, e.g. pos=0. The flowreturns to step 308 and a new value of position 0 is selected, i.e.val=vec(0)=2 in our example. The sign flag “got_sign_flag” indicatesthat a sign is detected and since the present value “val” is not equalto zero, the “next_sign_ind” is added to the accumulated index “index”as a LSB, giving an accumulated index of 4 (=2*2+0). The flow continuesto the evaluation of the value “val”, which is again not identical tozero. The next_sign_ind is set according to the detected sign, in thiscase next_sign_ind=0, i.e. a positive value (2). The accumulated indexis then counted up by an offset A(3,3), which corresponds to the numberof integer vectors of dimension 3 and L1-norm of 3, that has a positiveleading value and that does not have a leading zero. A(3,3) is equal to13. The accumulated index is now index=17. The accumulated k-parameterk_acc is then updated by the absolute value of “val”, i.e. by 2 units,i.e. k_acc=5.

The accumulated k_acc is now equal to the maximum K=5, and all positionsof the vector are considered. The output index is therefore equal to thepresent accumulated index, i.e. output index 17. The last identifiedsign is still not included in the accumulated index and is insteadextracted as a separate parameter, i.e. leading sign=“+1”(next_sign_ind=0).

In a second example, having a dimension N=3 and number of unit pulsesK=5, consider an integer input vector of [−4,0,−1]. The initializing isperformed and “pos” is set to “2”, index, k_acc to “0”, dimension n=1,and the got_sign_flag is unset (=0). The first value “val” is selectedas coefficient 2 of the vector, i.e. −1. Since no non-zero value hasbeen evaluated yet, no sign has been extracted, and the flow skips theadjustment of the index based on detected signs. The flow thereby passesdirectly to the evaluation of the value “val”, which is not identical tozero. This trigs the sign flag to be set. A first sign has beendetected, and next_sign_ind is set according to the detected sign, inthis case next_sign_ind=1, i.e. a negative value (−1). The accumulatedindex is then counted up by an offset A(1,0), which corresponds to thenumber of integer vectors of dimension 1 and L1-norm of 0, that has apositive leading value and that does not have a leading zero. A(1,0) isequal to 0. The accumulated index is now index=0. The accumulatedk-parameter k_acc is then updated by the absolute value of “val”, i.e.by 1 unit, i.e. k_acc=1.

A next repetition is prepared by increasing the number n by 1, i.e. n=2,and decreasing the position indicator “pos” by 1, e.g. pos=1. The flowreturns to step 308 and a new value of position 1 is selected, i.e.val=vec(1)=0 in our example. The sign flag “got_sign_flag” indicatesthat a sign is detected but since the present value “val” is equal tozero, the “next_sign_ind” is saved for the next repetition. The flowcontinues to the evaluation of the value “val”, which is identical tozero. The next_sign_ind is therefore not changed. The accumulated indexis then counted up by an offset A(2,1), which corresponds to the numberof integer vectors of dimension 2 and L1-norm of 1, that has a positiveleading value and that does not have a leading zero. A(2,1) is equalto 1. The accumulated index is now index=1. The accumulated k-parameterk_acc is then updated by the absolute value of “val”, i.e. by 0 units,i.e. still k_acc=1.

A next repetition is prepared by increasing the number n by 1, i.e. n=3,and decreasing the position indicator “pos” by 1, e.g. pos=0. The flowreturns to step 308 and a new value of position 0 is selected, i.e.val=vec(0)=−4 in our example. The sign flag “got_sign_flag” indicatesthat a sign is detected and since the present value “val” is not equalto zero, the “next_sign_ind”, emanating from vector position 2, is addedto the accumulated index “index” as a LSB, giving an accumulated indexof 3 (=2*1+1). The flow continues to the evaluation of the value “val”,which is not identical to zero. The next_sign_ind is set according tothe detected sign, in this case next_sign_ind=1, i.e. a negative value(−4). The accumulated index is then counted up by an offset A(3,1),which corresponds to the number of integer vectors of dimension 3 andL1-norm of 1, that has a positive leading value and that does not have aleading zero. A(3,1) is equal to 1. The accumulated index is nowindex=4. The accumulated k-parameter k_acc is then updated by theabsolute value of “val”, i.e. by 4 units, i.e. k_acc=5.

The accumulated k_acc is now equal to the maximum K=5, and all positionsof the vector are considered. The output index is therefore equal to thepresent accumulated index, i.e. output index 4. The last identified signis still not included in the accumulated index and is instead extractedas a separate parameter, i.e. leading sign=“−1” (next_sign_ind=1).

In a third example, having a dimension N=3 and number of unit pulsesK=5, consider an integer input vector of [0,5,0]. The initializing isperformed and “pos” is set to “2”, index, k_acc to “0”, dimension n=1,and the got_sign_flag is unset (=0). The first value “val” is selectedas coefficient 2 of the vector, i.e. 0. Since no non-zero value has beenevaluated yet, no sign has been extracted, and the flow skips theadjustment of the index based on detected signs. The flow thereby passesdirectly to the evaluation of the value “val”, which is identical tozero. This skips the trigging of the sign flag. A first sign has thusyet not been detected. The accumulated index is then counted up by anoffset A(1,0), which corresponds to the number of integer vectors ofdimension 1 and L1-norm of 0, that has a positive leading value and thatdoes not have a leading zero. A(1,0) is equal to 0. The accumulatedindex is now index=0. The accumulated k-parameter k_acc is then updatedby the absolute value of “val”, i.e. by 0 units, i.e. still k_acc=0.

A next repetition is prepared by increasing the number n by 1, i.e. n=2,and decreasing the position indicator “pos” by 1, e.g. pos=1. The flowreturns to step 308 and a new value of position 1 is selected, i.e.val=vec(1)=5 in our example. The sign flag “got_sign_flag” indicatesthat a sign is not yet detected. The flow thereby passes directly to theevaluation of the value “val”, which is not identical to zero. Thistrigs the sign flag to be set. A first sign has now been detected, andnext_sign_ind is set according to the detected sign, in this casenext_sign_ind=0, i.e. a positive value (5). The accumulated index isthen counted up by an offset A(2,0), which corresponds to the number ofinteger vectors of dimension 2 and L1-norm of 0, that has a positiveleading value and that does not have a leading zero. A(2,0) is equal to0. The accumulated index is now still index=0. The accumulatedk-parameter k_acc is then updated by the absolute value of “val”, i.e.by 5 units, i.e. k_acc=5.

A next repetition is prepared by increasing the number n by 1, i.e. n=3,and decreasing the position indicator “pos” by 1, e.g. pos=0. The flowreturns to step 308 and a new value of position 0 is selected, i.e.val=vec(0)=0 in our example. The sign flag “got_sign_flag” indicatesthat a sign is detected but since the present value “val” is equal tozero, the “next_sign_ind” is saved for the next repetition, or in thisexample the final step. The flow continues to the evaluation of thevalue “val”, which is identical to zero. The next_sign_ind is thereforeunchanged. The accumulated index is then counted up by an offset A(3,5),which corresponds to the number of integer vectors of dimension 3 andL1-norm of 5, that has a positive leading value and that does not have aleading zero. A(3,5) is equal to 41. The accumulated index is nowindex=41. The accumulated k-parameter k_acc is then updated by theabsolute value of “val”, i.e. by 0 units, i.e. still k_acc=5.

The accumulated k_acc is now equal to the maximum K=5, and all positionsof the vector have been considered. The output index is therefore equalto the present accumulated index, i.e. output index 41. The lastidentified sign is still not included in the accumulated index and isinstead extracted as a separate parameter, i.e. leading sign=“+1”(next_sign_ind=0).

In FIG. 8, a high level schematic view of an embodiment of a basic MPVQiteration instead using a sectioned leading sign encoding isillustrated. The figure illustrates a high level schematic view of anembodiment of a basic MPVQ-iteration using sectioned partitioning of theleading sign information. In a preferred solution, the two sign sectionsare implemented for each unique pos[0] amplitude k_delta, e.g.k_delta=[k−1, k−2, . . . 1]. For pos[0] value=“k”, all unit pulses areconsumed in pos[0] and the iteration can stop. For pos[0] value beingnon-zero, positive next leading sign, the first encountered non-zeroposition sign requires 1 bit of information. For pos[0] value beingnon-zero, negative next leading sign, the first encountered non-zeroposition sign requires 1 bit of information. For pos[0] value=“0”,iteration is extended to pos[0] without requiring any new leading signinfo.

From the iteration definition above, one can establish that:

M(n,k)=1+U(n,k)+U(n,k)+M(n−1,k)=1+2*U(n,k)+M(n−1,k)

M(n,k)−M(n−1,k)=1+2*U(n,k)

By applying Fischer's PVQ recursion, one obtains:

M(n,k)−M(n−1,k)=M(n−1,k−1)+M(n,k−1)

1+2*U(n,k)=M(n−1,k−1)+M(n,k−1)−M(n−1,k−1)+M(n−1,k−1)

1+2*U(n,k)=1+2*U(n,k−1)+2*M(n−1,k−1)

U(n,k)=U(n,k−1)+M(n−1,k−1)

M(n−1,k−1)=U(n,k)−U(n,k−1)

leading to

M(n−1,k)=[U(n,k+1)−U(n,k)]

From the recursion definition is known:

M(n,k)=1+2*U(n,k)+[U(n,k+1)−U(n,k)]=1+U(n,k)+U(n,k+1)

MPVQ-size can now be determined recursively as:

N _(MPVQ)(n,k)=M(n,k)=1+U(n,k)+U(n,k+1).

See further Appendix B for the derivation of the employed MPVQ recursionformula.

N _(MPVQ)(n,k)=1+2*U(n,k)+N _(MPVQ)(n−1,k)

In the enumeration/indexing use any of the below defined properties(a-g) that:

-   -   a) N_(PVQ)(n, k)=2*N_(MPVQ)(n, k), (recursively applied for        efficient indexing);    -   b) U(n,k)=1+U(n, k−1)+U(n−1, k−1)+U(n−1, k), with initial        conditions U(0,*)=0, U(*,0)=0, U(1,*)=0, U(*,1)=0, and U(a,        b)=U(b, a), and further for efficiency one can use U(2,k)=k−1,        and U(n,2)=n−1, and U(3,k)=k*(k−1), and U(n,3)=n(n−1);    -   c) N_(MPVQ)(n,k)=1+U(n, k)+U(n, k+1),        -   (final MPVQ-size calculation)    -   d) N_(MPVQ)(n,k)=1+floor((A(n,k))/2)+U(n, k+1),        -   (alternative final size calculation)    -   e) N_(MPVQ)(n,k)−N_(MPVQ)(n−1,k)=1+2*U(n, k)=A(n, k),        -   (can be used for iterative amplitude index addition            determination)    -   f) A(n,k)=A(n, k−1)+A(n−1, k−1)+A(n−1, k), (this recursion, also        used in e.g. CELT/OPUS-audio, can also be used here for low        complexity amplitude indexing offset updates)    -   g) Iteratively update the PVQ-offsets=U(n, k=0 . . . K+1) or        preferably iteratively update: A(n, k=0 . . . K) and U(n,K+1).        A(n,k) recursion is slightly faster than U(n,k) recursion and        the last element U(n,K+1) has lower dynamic range than A(n,K+1).

Here the c) and d) are used to calculate the size the final MPVQ(n, k)codeword, which is needed to obtain the index from the bit-stream, orwhich is provided to the bitstream or the arithmetic encoder/decoderwhich is interfacing the bit stream.

FIG. 9 illustrates a combination of three embodiments of a MPVQ-A/Uoffset recursion for increasing dimension.

The procedure for updating offsets starts in step 350. The inputparameters are the dimension n and the k_max+1 value. This procedureprovides indexing offsets of a row n−1 to indexing offsets of row n,including updating of offsets for k's of 0 . . . (k_max+1). In step 352,it is decided whether or not only A offsets are to be used. If that isthe case, in the step 354, A(n,k) is calculated as:

A(n,k)=A(n−1,k)+A(n−1,k−1)+A(n,k−1).

This particular recursion is utilized also in prior art, but togetherwith less efficient PVQ indexing processes. The A(n,k) is returned instep 397. In step 356, it is decided whether or not only U offsets areto be used. If that is the case, in step 358, U(n,k) is calculated as:

U(n,k)=1+U(n−1,k−1)+U(n−1,k)+U(n,k−1).

The U(n,k) is returned in step 398. In step 360, a combination of A andU offsets are to be used. In step 362, recursions for k=0 . . . (k_max)are performed according to:

A(n,k)=A(n−1,k)+A(n−1,k−1)+A(n,k−1).

This particular recursion is utilized also in prior art, but togetherwith less efficient PVQ indexing processes. For the highest dynamicsoffset (k_max+1), recursions are performed in step 364. In oneparticular embodiment, a pure U recursion is used according to:

U(n,k_max+1)=1+U(n−1,k_max)+U(n−1,k_max+1)+U(n,k_max).

In another particular embodiment, a mixed A/U recursion is usedaccording to:

U(n,k_max+1)=1+(A(n−1,k_max)>>1)+(A(n,k_max)>>)+U(n−1,k_max+1),

where (y>>1) signifies y=floor(y/2). The A(n,k) and U(n, k_max+1) arereturned in step 399.

At the receiver side, an opposite procedure has to be performed, inwhich a leading sign and an index is transformed into an integer outputvector. FIG. 10 illustrates a flow diagram of steps of an embodiment ofa method for pyramid vector quantization deindexing of audio/videosamples. The method starts in step 450. In step 452, a leading sign as afirst codeword and an input index as a second codeword are received froman ingoing bit stream. The leading sign and the input index representaudio/video signal samples. The leading sign is a sign of a terminalnon-zero coefficient in an integer output vector to be created,representing the audio/video signal samples. The integer output vectorhas a number of integer-valued coefficients. The terminal non-zerocoefficient is one of a first non-zero coefficient and a last non-zerocoefficient in said integer output vector. In step 454, the input indexis deindexed into the integer output vector with a pyramid vectorquantization de-enumeration scheme. The input index being created by anenumeration scheme is neglecting the sign of the terminal non-zerocoefficient. In step 456, a sign of the terminal non-zero coefficient inthe integer output vector is assigned according to the received leadingsign. In alternative embodiments, step 456 can be performed concurrentlyas, in combination with or before step 454. In step 458, the integeroutput vector is output. The process ends in step 499

In a particular embodiment, the step of deindexing 454 is performed byan iterative de-enumeration procedure. In a further particularembodiment, the iterative de-enumeration procedure comprises aninitializing step, in which a remaining index is set equal to the inputindex, and a repetition of an iteration step, in which one currentcoefficient of the integer output vector is selected for consideration.The iteration step in turn comprises finding of an offset parameterbeing compatible with a position of the current coefficient within theinteger output vector and with the remaining index, reducing of theremaining index in dependence of the offset parameter, and setting of anamplitude of the current coefficient of the integer input vector to beequal to an amplitude associated with the offset parameter. Therepetition is continued with coefficients of the integer input vectorbeing selected one after the other as the current coefficient at leastuntil the remaining index becomes equal to zero.

Some receiver side aspects of MPVQ-deindexing are illustrated in thefollowing using detailed block diagrams implementing embodiments of theprocesses. An overview of an embodiment of MPVQ deindexing isillustrated in FIG. 11. The MPVQ deindexing starts in step 250. In step260, VQ dimensions N and the number of unit pulses K are achieved fromthe codec bit allocation loop. In step 270, a size and offsets arefound. In step 280, a leading sign is extracted from the incoming bitstream and in step 285, the MPVQ index is obtained from the incoming bitstream. These quantities are utilized in step 290, where the MPVQ indexis decomposed. The process ends in step 299.

In comparison with the flow diagram of FIG. 10, steps 260, 270, 280 and285 can be considered as being comprised in the step 452. Steps 454 and456 are similarly considered to be comprised in step 290.

An embodiment of the procedures to find size and offsets, e.g.corresponding to step 270 of FIG. 11 is illustrated in FIG. 12. TheA(n,k) offset in deindexing is typically an amplitude offset, but italso accounts for the remaining signs.

The U(n,k) offset is similar. It is also an amplitude offset. However,it does not include the first leading sign (the “2”), but all the restof the remaining leading signs are included. The offsets in generalindicate the section sizes for the remaining possible combinations ofamplitudes and leading signs. Sometimes this is performed with thecurrent leading sign (A(n,k)) and sometimes without the next leadingsign, but all the rest (U(n,k) case). The procedure to find the MPVQsize N_(MPVQ)(N,K) and the indexing offsets A, U for dimension N fromk=0 to k=K+1 starts in step 500. Note that direct equations of A(n,k),A(n,k) row-only recursion and A basic recursion is known as such inprior art. In step 502, it is checked whether or not size and offsetsare stored in ROM tables. If so, which may be realistic if both N, and Kare low, the procedure continues directly with step 519. In step 504, itis checked whether or not an efficient direct calculation is possible.If so, which may be realistic for low N, the process continues to step506, in which direct equations are used for MPVQ size (N,K) andamplitude offsets A(N,K). The procedure then continues to step 519. Instep 508, it is checked whether or not an efficient row recursion ispossible. If so, which may be realistic for some K's, the processcontinues to step 510, in which recursive row-only equations are usedfor row N to calculate A(N, k=0 . . . K) and U(N,K+1). The procedurethen continues to step 514. If it in step 508 is found that row-onlyrecursion is not feasible, the procedure continues to step 512, in whichan offset update process is used for a basic column and row offsetrecursion equation for row 0 to row N to calculate offsets as A(N, k=0 .. . K) and U(N,K+1). This is possible for all N and K. One example ofsuch an update offset routine can be found in e.g. FIG. 9. In step 514,the MPVQ size can be calculated as MPVQ-size=1+(A(N,K)>>1)+U(N,K+1) oralternatively as MPVQ-size=l+U(N;K)+U(N,K+1). In step 519, the procedureis ended by returning offsets (A, U) and MPVQ size.

FIG. 13 illustrates an embodiment of MPVQ index decomposition. Theprocedure for decomposing an MPVQ index starts in step 520. Theparameters N, K, the input index and leading sign as well as offsetvalues are provided. A remaining index is set equal to the input index.In step 522, the output vector “vec” is initialized with zeros. In step524, the local maximum k, k_max_local is set equal to K, the position inthe vector starts from 0 and n is set to N. In step 526, it isinvestigated if all positions in the vector are considered. If so, thevector is returned as the output vector in step 548, i.e. an exit afterthe last position is treated. In step 528, it is investigated if theremaining index is zero. If so, no more vector positions are to befilled with non-zero values. The procedure continues to step 530, inwhich the leading sign is incorporated into and the vector is returnedas the output vector in step 549, i.e. a fast early exit before the lastposition has been treated. If the remaining index is larger than zero,the procedure continues to step 532, in which a k_delta, i.e. anabsolute amplitude of the vector position under investigation, and anamplitude offset “amp_offset” is found. This will be described more indetail further below. In step 534, the remaining index is reduced by theamplitude offset. If the amplitude of the vector position is not zero,as investigated in step 536, the procedure continues to step 538, wherethe vector position is given a value equal to the amplitude multipliedwith the leading sign. For the first non-zero coefficient, the leadingsign is the leading sign extracted from the bit stream. In step 540, anext leading sign for a future position is deduced. This is describedmore in detail further below. In step 542, the local maximum k value isreduced with the current k value “k_delta”. A next repetition is thenprepared in step 544 by increasing the dimension n, by updating theoffsets and by increasing the position in the vector by one step. Theprocedure then returns to step 526.

As indicated in FIG. 13, from the received index, the amplitude k_delta′of the current position is determined. This is preferably performed byusing available A(n,k) offsets and/or U(n,k) offsets. The amplitudeinformation offset is also deduced and the remaining index is reduced bythis amplitude information offset ‘amp_offset’. One embodiment of such aprocedure is illustrated in FIG. 14.

An embodiment of a procedure for finding the amplitude k_delta and theamplitude offset amp_offset starts in step 550. In other words, thisprocedure is supposed to find the amplitude of the current position andthe corresponding index offset. Linear or tree searches using offsets ofA(n,k) are, as such, available in prior art. The ingoing parameters arethe local maximum k “k_max_local”, the index and the offsetsH(n,k)=A(n,k). In step 552, a tree or linear search is selected. For thelinear search option, step 554 sets an accumulated k value, k_acc, equalto the local maximum k and an amplitude offset is set equal to an offsetfor the present n and the accumulated k value. In step 556, it ischecked whether or not the offset is larger than the index. If this isthe case, in step 558 the k_acc value is reduced by one unit, a newamplitude offset is derived. The procedure then returns to step 556.This is repeated until the largest amplitude offset value less than orequal to the remaining index is found. The procedure then continues tostep 560, in which the k_delta, i.e. the amplitude of the currentposition is calculated as the local maximum k value reduced by the k_accvalue.

If a tree procedure is selected, in step 562, a high and a low parameterare defined and an amplitude offset for n and the high parameter isdeduced. The k region to search is divided into two parts in step 564with a k_test parameter and an amplitude offset for n and the highparameter is deduced. Depending on if the amplitude offset in larger orsmaller than the index, as decided in step 566, The high parameter ischanged, in step 568, or the low parameter is changed, in step 572. Thisis repeated until either the difference between the amplitude offset andthe index becomes zero or the k_test point becomes equal to the highparameter, as checked in steps 570 and 574, respectively. In step 576,the k_delta, i.e. the amplitude of the current position is calculated asthe local maximum k value reduced by the k_test value. The amplitudek_delta, k_acc and amp_offset, where k_acc=k_max_local−k_delta is usedfor sectioned sign coding, are returned in step 579.

In FIG. 13, in step 536, if the magnitude is non-zero and less than themaximum remaining K unit pulses value, the previously extracted (stored)leading sign is applied in step 538, to the current position amplitude.Subsequently the next leading sign is to be extract from the decomposedreceived MPVQ-index. One embodiment of a procedure for finding the nextleading sign and removing the extracted sign information (bit orsign_offset) from the index is illustrated in FIG. 15.

The procedure for getting a next leading sign starts in step 580. Theinput parameters are the remaining index, the offsets and theaccumulated k value k_acc. In step 582, the sign positioning method isselected. If the LSB approach is selected, which presently is believedto be the preferred embodiment, the leading sign is initially set to bepositive (+1) in step 584. In step 586 the least significant bit inindex is determined, using a bitwise ‘and’ operation. If the bit is a“1”, this signifies a negative sign and the leading sign is consequentlychanged to “−1” in step 588. In step 590, the index is shifted oneposition, i.e. shifting out the sign bit.

If a sectioned leading sign decoding is selected, which is a little bitmore complex, the leading sign is initially set to be positive (1) instep 592. In step 594, the size of the k_delta segment is divided by 2.If the index is larger than or equal to this sign offset, the sign isnegative and the leading sign is consequently changed in step 597. Instep 598, the index is also reduced by the found sign offset. Theleading sign and modified index are returned in step 599.

Returning again to FIG. 13, if the current position has zero amplitude,the leading sign is kept, i.e. remembered for potential use in the nextposition after the current position.

If the magnitude equals the maximum remaining K unit pulses value, thestored leading sign is applied. Optionally a fast iteration exit can beused for this last non-zero entry, and exit early with a series oftrailing zeroes. This is optional as sometimes in DSP-HW the cost ofconditionally exiting an optimized constant length loop is higher thanstaying in the loop.

The offsets A(n,k) (or U(n,k) can be updated recursively for theremaining vector, with one dimension less to de-index and ‘k_delta’ lessunit pulses to de-index. One embodiment of a procedure for offsetupdating for one dimension less is illustrated in FIG. 16. The procedureis similar to the one presented in FIG. 9, but here, the dimension isreduced instead of increased.

The procedure for updating offsets starts in step 600. The inputparameters are the dimension n and the k_max value. This procedureprovides indexing offsets of a row n+1 to indexing offsets of row n,including updating of offsets for k's of 0 . . . k_max. In step 602, itis decided whether or not only A offsets are to be used. If that is thecase, in the step 604, A(n,k) is calculated as:

A(n,k)=A(n+1,k)−A(n,k−1)−A(n+1,k−1).

This particular recursion is utilized also in prior art, but togetherwith less efficient PVQ indexing processes. The A(n,k) is returned instep 617. In step 606, it is decided whether or not only U offsets areto be used. If that is the case, in step 608, U(n,k) is calculated as:

U(n,k)=U(n+1,k)−U(n,k−1)−U(n+1,k−1)−1.

The U(n,k) is returned in step 618. In step 610, a combination of A andU offsets are to be used. In step 612, recursions for k=0 . . .(k−max−1) are performed according to:

A(n,k)=A(n+1,k)−A(n,k−1)−A(n+1,k−1).

This particular recursion is utilized also in prior art, but togetherwith less efficient PVQ indexing processes. For the highest dynamicsoffset k_max, where k_max=K+1, recursions are performed in step 614. Inone particular embodiment, a pure U recursion is used according to:

U(n,k_max)=U(n+1,k_max)−U(n,k_max−1)−U(n+1,k_max−1)−1.

In another particular embodiment, a mixed A/U recursion is usedaccording to:

U(n,k_max)=U(n+1,k_max)−(A(n,k_max−1)>>1)−(A(n+1,k_max−1)>>1)−1,

where (y>>1) signifies y=floor(y/2). The A(n,k) and U(n, k_max) arereturned in step 619.

Three examples are described here below, in order to support theunderstanding of the structure of FIG. 13. The examples are of anextremely low complexity in order to keep the description limited and tomake the total example perceivable. However, in typical real examples,the dimensions and the number of unit pulses are far higher. Theprinciples are however the same.

In a first example, having a dimension N=3 and number of unit pulsesK=5, consider an input index of 17 and a leading sign “+1”, i.e.positive. The initializing is performed and “pos” is set to “0”, i.e.the de-indexing starts from the first coefficient in the vector,k_max_local to “5”, and dimension n=3. The input index is “renamed” intoa remaining index. The position is lower than 3 and the remaining indexis non-zero. An amplitude k_delta and offset amp_offset is searched(e.g. according to FIG. 14). If e.g. the A offsets are used, the groupof offsets A(3,0 . . . 5 are investigated and the largest A offset thatstill is smaller than or equal to the remaining index is A(3,3)=13.k_acc therefore becomes 3, k_delta becomes 2 and amp_offset equals 13.The remaining index is reduced by the amp_offset and becomes now equalto 4. Since k_delta is not equal to zero, there is a sign to be applied.The vector position is therefore set to the absolute value (k_delta)times the received and stored leading sign, which was positive. Theoutput vector is now [2,0,0]. A determination of a next leading sign isthen performed, e.g. according to FIG. 15. If assuming an LSB signpositioning, the LSB of the remaining index (4) is zero, whichcorresponds to a positive sign. The lead_sign is therefore set to “+1”.The remaining index is also reduced by shifting the index one step, i.e.equal to an integer division by 2. The remaining index is now equal to2. Finally, the remaining pulse units k_max_local are updated and is now3.

A next repetition is prepared by reducing the number n by 1, i.e. n=2,and increasing the position indicator “pos” by 1, e.g. pos=1. Theavailable offsets are also updated according to the new n. The flowreturns to step 526 and a new amplitude and offset is to be found (e.g.according to FIG. 14). If e.g. the A offsets are used, the group ofoffsets A(2,0 . . . 3 are investigated and the largest A offset thatstill is smaller than or equal to the remaining index is A(2,1)=1. k_acctherefore becomes 1, k_delta becomes 2 and amp_offset equals 1. Theremaining index is reduced by the amp_offset and becomes now equal to 1.Since k_delta is not equal to zero, there is a sign to be applied. Thevector position is therefore set to the absolute value (k_delta) timesthe recently extracted leading sign, which was positive. The outputvector is now [2,2,0]. A determination of a next leading sign is thenperformed, e.g. according to FIG. 15. If assuming an LSB signpositioning, the LSB of the remaining index (1) is 1, which correspondsto a negative sign. The lead_sign is therefore set to −1. The remainingindex is also reduced by shifting the index one step, i.e. equal to aninteger division by 2. The remaining index is now equal to 0. Finally,the remaining pulse units k_max_local are updated and is now 1.

A next repetition is prepared by reducing the number n by 1, i.e. n=1,and increasing the position indicator “pos” by 1, e.g. pos=2. Theavailable offsets are also updated according to the new n. The flowreturns to step 526. Since the remaining index is zero, the step 530 isperformed to give the last vector coefficient. lead_sign is equal to −1and k_max_local is equal to 1, which gives an output vector of [2,2,−1].

In a second example, having a dimension N=3 and number of unit pulsesK=5, consider an input index of 4 and a negative leading sign. Theinitializing is performed and “pos” is set to “0”, i.e. the de-indexingstarts from the first coefficient in the vector, k_max_local to “5”, anddimension n=3. The input index is “renamed” into a remaining index. Theposition is lower than 3 and the remaining index is non-zero. Anamplitude k_delta and offset amp_offset is searched (e.g. according toFIG. 14). If e.g. the A offsets are used, the group of offsets A(3,0 . .. 5 are investigated and the largest A offset that still is smaller thanor equal to the remaining index is A(3,1)=1. k_acc therefore becomes 1,k_delta becomes 4 and amp_offset equals 1. The remaining index isreduced by the amp_offset and becomes now equal to 3. Since k_delta isnot equal to zero, there is a sign to be applied. The vector position istherefore set to the absolute value (k_delta) times the received leadingsign, which was negative. The output vector is now [−4,0,0]. Adetermination of a next leading sign is then performed, e.g. accordingto FIG. 15. If assuming an LSB sign positioning, the LSB of theremaining index (3) is 1, which corresponds to a negative sign. Thelead_sign is therefore set to −1. The remaining index is also reduced byshifting the index one step, i.e. equal to an integer division by 2. Theremaining index is now equal to 2. Finally, the remaining pulse unitsk_max_local are updated and is now 1.

A next repetition is prepared by reducing the number n by 1, i.e. n=2,and increasing the position indicator “pos” by 1, e.g. pos=1. Theavailable offsets are also updated according to the new n. The flowreturns to step 526 and a new amplitude and offset is to be found (e.g.according to FIG. 14). If e.g. the A offsets are used, the group ofoffsets A(2,0 . . . 1 are investigated and the largest A offset thatstill is smaller than the remaining index is A(2,1)=1. k_acc thereforebecomes 1, k_delta becomes 0 and amp_offset equals 1. The remainingindex is reduced by the amp_offset and becomes now equal to 1. Sincek_delta is equal to zero, the last extracted sign is saved for a nextrepetition. The output vector is still [−4,0,0].

A next repetition is prepared by reducing the number n by 1, i.e. n=1,and increasing the position indicator “pos” by 1, e.g. pos=2. Theavailable offsets are also updated according to the new n. The flowreturns to step 526 and a new amplitude and offset is to be found (e.g.according to FIG. 14). If e.g. the A offsets are used, the group ofoffsets A(1,0 . . . 1 are investigated and the largest A offset thatstill is smaller than or equal to the remaining index is A(1,1)=1. k_acctherefore becomes 1, k_delta becomes 0 and amp_offset equals 1. Theremaining index is reduced by the amp_offset and becomes now equal to 0.Since k_delta is not equal to zero, there is a sign to be applied. Thevector position is therefore set to the absolute value (k_delta) timesthe previously extracted leading sign, which was negative. The finaloutput vector is now [−4,0,−1].

In a third example, having a dimension N=3 and number of unit pulsesK=5, consider an input index of 41 and a positive leading sign. Theinitializing is performed and “pos” is set to “0”, i.e. the de-indexingstarts from the first coefficient in the vector, k_max_local to “5”, anddimension n=3. The input index is “renamed” into a remaining index. Theposition is lower than 3 and the remaining index is non-zero. Anamplitude k_delta and offset amp_offset is searched (e.g. according toFIG. 14). If e.g. the A offsets are used, the group of offsets A(3,0 . .. 5 are investigated and the largest A offset that still is smaller thanor equal to the remaining index is A(3,5)=41. k_acc therefore becomes 5,k_delta becomes 0 and amp_offset equals 41. The remaining index isreduced by the amp_offset and becomes now equal to 0. Since k_delta isequal to zero, the sign is saved for a later iteration. The outputvector is still [0,0,0].

A next repetition is prepared by reducing the number n by 1, i.e. n=2,and increasing the position indicator “pos” by 1, e.g. pos=1. Theavailable offsets are also updated according to the new n. The flowreturns to step 526 and a new amplitude and offset is to be found (e.g.according to FIG. 14). If e.g. the A offsets are used, the group ofoffsets A(2,0 . . . 5 are investigated and the largest A offset thatstill is smaller than or equal to the remaining index is A(2,0)=0. k_acctherefore becomes 0, k_delta becomes 5 and amp_offset equals 0. Theremaining index is reduced by the amp_offset and becomes now equal to 0.Since k_delta is not equal to zero, there is a sign to be applied. Thevector position is therefore set to the absolute value (k_delta) timesthe received and stored leading sign, which was positive. The outputvector is now [0,5,0].

A next repetition is prepared by reducing the number n by 1, i.e. n=1,and increasing the position indicator “pos” by 1, e.g. pos=2. The flowreturns to step 526. In step 528, it is found that the index is zero andthe fast exit via steps 530 and 549 is used.

This new indexing approach, presented in the present disclosure, is animproved low complex short codeword scheme. In design it is a solutionbased on the optimized pure magnitude indexing schemes(Fischer/Hung/Opus/CELT) but in addition it makes efficient use of thefact that the size of any PVQ structure always is an even number ofvectors.

There will still be a need to handle very large PVQ-vectors (larger than1+B) bits in an efficient way. This can be performed e.g. by targetvector dimension splitting, PVQ-vector dimension splitting or costlyhigher dynamic range integer calculations, for instance n*16 or n*32virtual, software defined large integers.

The gain of going from B to B+1 bits (e.g. 32 to 33 bits) can bequantified as the extended R=bits/coefficient range capability wheredimension splitting is not needed for a given dimension. E.g. fordimension N=8, one goes from R=32/8=4 bits/coefficient (or sample) toR=33/8=4.125 bits per coefficient or sample. Typically R=7 shapebits/coefficient (or sample) is required for a high quality frequencydomain audio PVQ-scheme.

FIG. 17A presents an overview of the PVQ-codewords for some commonhardware bit limits. Curve 900 denotes PVQ(n,k) bitlimit 33, curve 901denotes PVQ(n,k) bitlimit 32, curve 902 denotes PVQ(n,k) bitlimit 31,curve 903 denotes PVQ(n,k) bitlimit 17, curve 904 denotes PVQ(n,k)bitlimit 16, and curve 905 denotes PVQ(n,k) bitlimit 15. 33 bits arepossible to use with new scheme and unsigned 32-bit integers, 32 bitscorresponds to unsigned 32-bit integer, 31 bits corresponds to signed32-bit integers, 17 bits are possible to use with new scheme andunsigned 16-bit integers, 16 bits correspond to unsigned 16-bitintegers, bits correspond to signed 16-bit integer.

FIG. 17B presents an overview of the related R values in bits/sample foroptimal PVQ-codeword quantizers with different BIT limits. Curve 910denotes PVQ(n,k) bitlimit 33, curve 911 denotes PVQ(n,k) bitlimit 32,curve 912 denotes PVQ(n,k) bitlimit 31, curve 913 denotes PVQ(n,k)bitlimit 17, curve 914 denotes PVQ(n,k) bitlimit 16, and curve 915denotes PVQ(n,k) bitlimit 15. With higher R values, higher codingquality can be achieved.

FIG. 17C shows the corresponding achievable pulse density, which isdirectly correlated to the resulting shape matching capability of again-shape PVQ. Curve 920 denotes PVQ(n,k) bitlimit 33, curve 921denotes PVQ(n,k) bitlimit 32, curve 922 denotes PVQ(n,k) bitlimit 31,curve 923 denotes PVQ(n,k) bitlimit 17, curve 924 denotes PVQ(n,k)bitlimit 16, and curve 925 denotes PVQ(n,k) bitlimit 15. With higher Rvalues, higher coding quality can be achieved. The possible pulsedensity for optimal PVQ-codeword quantizers are shown with differentBIT-limits. With higher pulse densities higher coding quality, e.g.higher VQ SNR, can be achieved.

FIG. 17D illustrates a worst case MOPS Instruction trade-off inindexing/deindexing for a sample prior art scheme PVQ and for the newscheme MPVQ, both using PVQ-codewords of maximum size 32 for a faircomparison. Curve 930 denotes total complexity for MPVQ, curve 931denotes total complexity for PVQ, curve 932 denotes deindexingcomplexity for MPVQ, curve 933 denotes deindexing complexity for PVQ,curve 934 denotes indexing complexity for MPVQ, and curve 935 denotesindexing complexity for PVQ. MPVQ above can be implemented on a signed32-bit architecture, while prior art PVQ requires an unsigned 32-bitarchitecture.

In a second part of the presently presented technology a low dynamicMPVQ runtime calculation of offsets is described. In Appendix A, thehigh level text description from the OPUS RFC is repeated as background.In the IETF-OPUS c-code (cwrs.c) the dynamically runtime calculatedindexing offset A(n,k) is used for both sign and amplitude indexing.Note however, that a different offset variable name is used in OPUSc-code. The number A(n, k) represents the number of vectors PVQ(n,k)that starts with a positive non-zero value in the first position. It hasbeen found in prior art that

A(n,k)=(N _(PVQ)(n,k−1)+N _(PVQ)(n−1,k−1))/2,

In words, the number A is a weighted sum of a row n element and aprevious row n−1 element in the PVQ-size matrix N(n, k).

Table 1, for A(n,k), shows an example where the prior art (CELT/OPUS)PVQ offset data scheme used, where for memory efficiency only one rowe.g. n==3 is stored in RAM memory, for a given point in the forwardrecursion, and then n=4 is calculated based on row n=3, and so on.

Note that in a real world PVQ implementation for speech and audio codingthe dimension n can be around 256 and number of unit pulses k can bearound 512, depending on the target DSP capacity. So storing n*k offsetsis often not feasible.

TABLE 1 Prior art A (n, k) offsets needed for PVQ(n = 6, k = 5)calculated for PVQ decoding/encoding in e.g. a IETF- OPUS-Audio likeindexing scheme n/k 0 1 2 3 4 5 k = 6 0 1 1 1 1 1 1 1 1 2 1 3 5 7 9 11 31 5 13 25 41 61 4 1 7 25 63 129 231 5 1 9 41 129 321 681 6 1 11 61 231681 1683

The dynamic indexing offset calculations can, however, be improved. Thehere proposed novel recursion is

U(n,k)=U(n,k−1)+U(n−1,k−1)+U(n−1,k)+1,

It can be found that it relates to the previously employed, OPUS/CELTprior art offsets A(n,k) as:

A(n,k)=2*U(n,k)+1.

The integer range dynamics of U(n, k) is now always at least half of theA(n,k) range. This means that 1 bit extra can be made available for fastindexing, e.g. inside a 32 bit word. Also U(2,k) and U(3,k) can bedirectly computed faster than for A(2,k) and A(3,k), as U(2,k)=k−1,U(3,k)=k*(k−1), and U(a,b)=U(b,a) symmetrically.

TABLE 2 New Low dynamic range U(n, k) indexing offsets, calculated forMPVQ(n = 6, k = 5) n/k 0 1 2 3 4 5 k = 6 0 1 2 1 2 3 4 5 3 2 6 12 20 304 3 12 31 64 115 5 4 20 64 160 340 6 5 30 115 340 841

In the Tables 1 and 2 above one can see that A(n=6,k=6)=1683 cannot fitwithin 10 bits. 10 bits corresponds to 1024 entries, e.g. values 0-1023.However, the new offset U(n=6, k=6) will fit within 10 bits. As theindexing offsets needs to be exactly calculated for successful exactindexing/de-indexing, offset A(6,6) cannot be allowed to saturate to1023, or be wrapped to an incorrect low value.

The previous (IETF/OPUS-Audio PVQ-prior art) recursion is

A(n,k)=A(n,k−1)+A(n−1,k−1)+A(n−1,k).

It has three addition terms, making it a slightly faster to calculate,especially for high n or high k compared to the new U(n,k) recursionwhich has addition of 4 terms.

To keep recursion efficiency and maintain a low dynamic range when it isneeded one can in another embodiment define a preferred mixed recursionwhere U(n, KMAX) is a function of previous A(n, lower k) offset values,and only used for dynamic recursion data that is close to the rangelimit of a B-bit word. This is typically true for the last column KMAXin a N-row-based recursion. In Table 3 it is seen that the offsets stillstays within 10 bits, compared to Table 1, which last entry exceedsbits.

TABLE 3 mixed A (n, k) and last k column U(n, 6 = KMAX) offsetscalculated for efficient and range safe indexing recursion. k = 6(U) n/k0(A) 1(A) 2(A) 3(A) 4(A) 5(A) KMAX 0 1 1 1 1 1 1 1 0 2 1 3 5 7 9 5 3 1 513 25 41 30 4 1 7 25 63 129 115 5 1 9 41 129 321 340 6 1 11 61 231 681841 NMAX

Note that typically it is the last n-row NMAX (6 in this case) andhighest (k=6 in this case) that causes dynamic range troubles. However,in some cases also the second last row (NMAX-1) may cause rangeproblems, e.g. in row-only recursion calculations, when the numerator ina division is close to the hardware bit limit.

The derivation of the above recursive relations for the MPVQ scheme canbe found in Appendix B.

An example of a prior art PVQ indexing scheme is presented in Table 4.Here, the maximum index value, A(n, k)+A(k+1)−1, needs to be less thane.g. 232. The scheme in Table 4 with switched signs [{+, 0}/−] is usedin prior art OPUS/CELT. Comments: a) vector [−2,−1,1]; b) Here forindices 25-40, de-indexing a zero in position p0 may eventually become apositive value or a negative value or a zero in p1; c) p0 positivedecision limit.

A prior art PVQ-indexing with [{+, 0}/−] PVQ recursive deindexing schemePVQ(n=3,k=4), N_(PVQ)=66, [{−, 0}/+] prior art indexing (blue, white)cells pX=position in the 3-dimensional vector [p0, p1, p2], k=4 unitpulses can be encoded, e.g. decoded index 7->vector [−2, −1, 1], offsetsA(n,k) are used to determined signs, and the relationN_(PVQ)(n=3,k=4)=A(n,k)+A(n,k+1) is used to determine the size fromthese offsets.

TABLE 4 Example prior art PVQ indexing scheme. ind p0 p1 P2 Com. 0 A(n,k + 1) −4 A(n, k) A(n, k − 1) A(n, k − 2) A(n, k − 3) 0 0 1 −3 1 0 2 −30 −1 3 −3 0 1 4 −3 1 0 5 −2 −2 0 6 −2 −1 −1 7 −2 −1 1 a 8 −2 0 −2 9 −2 02 10 −2 2 0 11 −2 1 −1 12 −2 1 1 13 −1 −3 0 14 −1 −2 −1 15 −1 −2 1 16 −1−1 −2 17 −1 −1 2 18 −1 0 −3 19 −1 0 3 20 −1 3 0 21 −1 2 −1 22 −1 2 1 23−1 1 −2 24 −1 1 2 25 0 A(n, k − 1) −4 0 b 26 0 −3 −1 27 0 −3 1 28 0 −2−2 29 0 −2 2 30 0 −1 −3 31 0 −1 3 32 0 0 −4 33 0 0 4 34 0 4 0 35 0 3 −136 0 3 1 37 0 2 −2 38 0 2 2 39 0 1 −3 40 0 1 3 41 A(n, k) 4 A(n, k − 1)A(n, k − 2) A(n, k − 3) 0 0 c 42 3 −1 0 43 3 0 −1 44 3 0 1 45 3 1 0 46 2−2 0 47 2 −1 −1 48 2 −1 1 49 2 0 −2 50 2 0 2 51 2 2 0 52 2 1 −1 53 2 1 154 1 A(n, k − 2) −3 0 55 1 −2 −1 56 1 −2 1 57 1 −1 −2 58 1 −1 2 59 1 0−3 60 1 0 3 61 1 3 0 62 1 2 −1 63 1 2 1 64 1 1 −2 65 1 1 2

The A and U relations can be graphically seen in Table 5 for theMPVQ(3,5) example, using a leading sign recursive solution.N_(PVQ)(n=3,k=5)=2*N_(MPVQ)(3,5)=2*51=102, where the “2” corresponds toa now pre-extracted leading sign bit. The vector PVQ-vec=[p0,p1,p2],e.g. decoded index 8 is [3, −1, 1], sum(abs(PVQ−vec))=5, In the Table 5below the now pre-extracted initial sign is positive (+), i.e. the valuep0 below is always larger than or equal to 0. In the example the nextleading sign is stored in the LSB-bit of the 2*U(n, k) sections.

TABLE 5 Example MPVQ(3, 5) LSB based leading sign enumeration. Size SizeVal. Size lead Val. lead Val. ind (A(n, k)) (U(n, k)) p0 new K sign p1sign p2 0 A(n, K) = 1 5 1, new K = 5 none 0 none 0 1 A(3, 5) 2*U(n, K) 4new K = + 1 none 0 2 4 K − 4 = 1 − −1 none 0 3 4 + 0 kept 1 4 4 − 0 kept−1 5 3 new K = + 2 0 6 3 K − 3 = 2 − −2 0 7 3 + 1 + 1 8 3 − −1 + 1 9 3 +1 − −1 10 3 − −1 − −1 11 3 + 0 + 2 12 3 − 0 − −2 13 2 new K = + 3 0 14 2K − 2 = 3 − −3 0 15 2 + 2 + 1 16 2 − −2 + 1 17 2 + 2 − −1 18 2 − −2 − −119 2 + 1 + 2 20 2 − −1 + 2 21 2 + 1 − −2 22 2 − −1 − −2 23 2 + 0 kept 324 2 − 0 kept −3 25 1 new K = + 4 none 0 26 1 K − 1 = 4 − −4 none 0 271 + 3 + 1 28 1 − −3 + 1 29 1 + 3 − −1 30 1 − −3 − −1 31 1 + 2 + 2 32 1 −−2 + 2 33 1 + 2 − −2 34 1 − −2 − −2 35 1 + 1 + 3 36 1 − −1 + 3 37 1 + 1− −3 38 1 − −1 − −3 39 1 + 0 kept 4 40 1 − 0 kept −4 41 (A(n, K + 1) −U(n, K + 1) − 0 size = kept 5 none 0 42 A(n, K))/2 U(n, K) 0 1 + (+) 4 +1 43 0 U(n − 1, K) + 4 − −1 44 0 U(n − 1, K + 1) 3 + 2 45 0 new K 3 − −246 0 K = 5 2 + 3 47 0 2 − −3 48 0 1 + 4 49 0 1 − −4 50 0 0 kept 5

Table 6 illustrates index construction examples according to Table 5.

TABLE 6 Example MPVQ(3, 5) LSB based leading sign enumeration, indexconstruction examples. lead lead index Value p0 sign Value p1 sign Valuep2 Index construction examples 0 5 none 0 none 0 A(3, 0) = 0 1 4 + 1none 0 A(3, 1) + 2*(A(2, 0)) + 0 = 1 2 4 − −1 none 0 A(3, 1) + 2*(A(2,0)) + 1 = 2 3 4 + 0 kept 1 A(3, 1) + 2*(A(2, 1)) + 0 = 3 4 4 − 0 kept −1A(3, 1) + 2*(A(2, 1)) + 1 = 4 5 3 + 2 0 A(3, 2) + 2*(A(2, 0)) + 0 = 5 63 − −2 0 A(3, 2) + 2*(A(2, 0)) + 1 = 6 7 3 + 1 + 1 A(3, 2) + 2*(A(2,1)) + 0 = 7 8 3 − −1 + 1 A(3, 2) + 2*(A(2, 1)) + 1 = 8 9 3 + 1 − −1 A(3,2) + 2*(A(2, 1) + 1) + 0 = 9 10 3 − −1 − −1 A(3, 2) + 2*(A(2, 1) + 1) +1 = 10 11 3 + 0 + 2 12 3 − 0 − −2 13 2 + 3 0 A(3, 3) + 2*0 + 0 = 13 14 2− −3 0 A(3, 3) + 2*0 + 1 = 14 15 2 + 2 + 1 A(3, 3) + 2*(A(2, 1) + 0) + 0= 15 16 2 − −2 + 1 A(3, 3) + 2*(A(2, 1) + 0) + 1 = 16 17 2 + 2 − −1 A(3,3) + 2*(A(2, 1) + 0) + 1 = 17 18 2 − −2 − −1 A(3, 3) + 2*(A(2, 1) + 1) +1 = 18 19 2 + 1 + 2 20 2 − −1 + 2 21 2 + 1 − −2 22 2 − −1 − −2 23 2 + 0kept 3 24 2 − 0 kept −3 25 1 + 4 none 0 A(3, 4) + 2*(A(2, 0)) + 0 = 2426 1 − −4 none 0 A(3, 4) + 2*(A(2, 0)) + 1 = 25 27 1 + 3 + 1 28 1 − −3 +1 29 1 + 3 − −1 30 1 − −3 − −1 31 1 + 2 + 2 32 1 − −2 + 2 33 1 + 2 − −234 1 − −2 − −2 35 1 + 1 + 3 36 1 − −1 + 3 37 1 + 1 − −3 A(3, 4) +2*(A(2, 3)) + 0 = 37 38 1 − −1 − −3 A(3, 4) + 2*(A(2, 3)) + 1 = 38 391 + 0 kept 4 A(3, 4) + 2*(A(2, 3)) + 0 = 39 40 1 − 0 kept −4 A(3, 4) +2*(A(2, 4)) + 1 = 40 41 0 kept 5 none 0 A(3, 5) = 41 42 0 (+) 4 + 1 A(3,5) + A(2, 1) + 0 = 42 43 0 4 − −1 A(3, 5) + A(2, 1) + 1 = 43 44 0 3 + 2A(3, 5) + A(2, 2) + 0 = 44 45 0 3 − −2 A(3, 5) + A(2, 2) + 1 = 45 46 02 + 3 A(3, 5) + A(2, 3) + 0 = 46 47 0 2 − −3 A(3, 5) + A(2, 3) + 1 = 4748 0 1 + 4 A(3, 5) + A(2, 4) + 0 = 48 49 0 1 − −4 A(3, 5) + A(2, 4) + 1= 49 50 0 0 kept 5 A(3, 5) + A(2, 5) = 50

Note that the PVQ-size in Table 5 now has to be computed usingN_(MPVQ)=1+U(n,k)+U(n,K+1), as A(n,k+1), cannot be computed safelywithin the 2*N_(MPVQ)(n,k) bit-limit (e.g. 32 bits) for all n, k. Priorart uses PVQ-size=A(n,K+1)+A(n,K), or a summation over non-zero elementsusing MOPS costly combinatorial functions or a ROM costly table lookupof stored values.

A(n,k) can also be found as 1+2*U(n,k) in the basic recursion schematicsof FIG. 5 (Sectioned positioning of the leading sign(s)) and in FIG. 2(LSB positioning of the leading sign(s)).

In another part of the presently presented technology an optimizedMPVQ-indexing through pre-extraction of sign encoding positions isdescribed. It is also possible to optimize the encoder side MPVQ indexcomposition inner loop by pre-extracting the MPVQ leading signs into avector of sign encoding positions encode_sign [0 . . . N−1], and theactual sign to encode at that position, and the remaining initialleading sign. However, this requires running a pre-processing signshifting function which may be costly in the case of few pulses.However, in some cases it can be the preferred way to implement theMPVQ-indexing as the inner loop of the index-composition becomes evenmore straightforward, and can be strongly optimized e.g. forDSP-pipelining.

FIG. 24 illustrates an example of sign pre-shifting that utilizes N=8and K=13.

In FIG. 24, the encoding is done right to left, i.e. position (N−1) toposition 0.

The pre-shifting function shifts the first sign to the variable‘lead_sign’ and the rest of the signs in PVQ-vec are shifted to the next(to the left) non-zero position. The last non-zero position in PVQ-vecwill always get a 0 value in the encode_sign vector.

FIG. 18 illustrates an embodiment of a MPVQ-index composition usingpre-extracted leading signs. There, embodiments of detailed blockdiagrams for this MPVQ-index composition implementation are shown. Theprocedure to compose MPVQ index with pre-extracted leading signs andMPVQ size starts in step 700. This embodiment is based on a solutionwith next sign in LSB position. Input parameters are N, K and thePVQ-vector as “vec”. Step 702 is an initializing step, with known offsetrecursion base case, and set n=1. In step 704, the position parameter isset to N−1, i.e. the vector is analyzed from the end towards thebeginning starting with the last position. The accumulated index and theaccumulated pulses are set to 0 in step 706. First, in step 708, thesigns are analyzed, which will be described more in detail furtherbelow.

The leading sign is thereby determined, and a sign vector is available.In step 710, a value is set equal to the current input vectorcoefficient. In steps 712-720, the accumulated index is adapted for thesign of the coefficient, if the coefficient is non-zero, in thisembodiment by adding a LSB. In step 722, the accumulated index ismodified according to the offset associated with the remaining unitpulses and the present dimension. If the present position is non-zero,as checked in step 724, i.e. the search has not reached the front of theinput vector, a new repetition is prepared in steps 726 and 728 and theprocedure returns to step 710. If the entire vector is searched, theMPVQ-SIZE is calculated in step 730 and the outgoing index, leading signand MPVQ size are provided in step 739.

FIG. 19 illustrates an embodiment of a sign extraction function. Theprocedure starts in step 740. In step 742, initializing is performed,giving an encoded sign vector 0-coefficients, assuming a positiveleading sign, giving a temporary position of initial non-zerocoefficient as −1 and starts with position number 0. In step 744, it ischecked if the position is less than the maximum and still no leadingsign is found. If so, in step 746, it is checked if the vectorcoefficient of the current position is zero. If so, the present positionis stepped one step forward in step 754 and the process is iterated. Ifthe present vector coefficient is non-zero, the procedure continues tostep 748, where a negative coefficient results in a negative lead_signin step 750. The position of the first non-zero coefficient is recordedas initial_pos in step 752 before the procedure continues to step 754.If it in step 744 is found that the leading sign is found, the procedurecontinues to step 756, in which the sign vector encode_sign procedure isinitialized. Steps 758-766 continue to search through the input vectorfor non-zero coefficients, and corresponding positions in the signvector are given the sign of the following non-zero coefficient. Whenall positions are investigated, the leading sign and the sign vector arereturned in step 769.

A benefit with this approach is that the pre-shifting orpre-localization of the leading sign encoding positions makes itpossible to avoid leading sign shuffling in the indexing inner iterationloop. This can be a benefit when one wants to optimize the encodinginner loop in certain hardware where branches (IFs/ELSEs) are costly toimplement.

Table 7 illustrates an MPVQ Sectioned leading sign iteration example.N_(PVQ)(n=3,k=5)=2*N_(MPVQ)(3,5)=2*51=102, where the “2” corresponds toa now pre-extracted leading sign bit. The vector PVQ-vec=[p0, p1, p2],e.g. decoded index 8 is [3, 0, 2], sum(abs(PVQ-vec))=5. In the Table 7the now pre-extracted initial sign is positive, in the example the nextleading sign derived from the low/high sections of the 2*U(n, k) initialamplitude sections.

TABLE 7 Example MPVQ(3, 5) Sectioned leading sign enumeration. Size SizeVal. Size lead Val. lead Val. ind (A(n, k)) (U(n, k)) p0 new K sign p1sign p2 0 A(n, K) = 1 5 1, new K = 5 + 0 none 0 1 A(3, 5) 2*U(n, K) 4new K = + 1 none 0 2 4 K − 4 = 1 − 0 kept 1 3 4 − 1 none 0 4 4 + 0 kept1 5 3 new K = + 2 none 0 6 3 K − 3 = 2 + 1 + 1 7 3 + 1 − −1 8 3 − 0 kept2 9 3 − −2 none 0 10 3 − −1 + 1 11 3 − −1 − −1 12 3 + 0 kept −2 13 2 newK = + 3 none 0 14 2 K − 2 = 3 + 2 + 1 15 2 + 2 − −1 16 2 + 1 + 2 17 2 +1 − −2 18 2 − 0 kept 3 19 2 − −3 none 0 20 2 − −2 + 1 21 2 − −2 − −1 222 − −1 + 2 23 2 − −1 − −2 24 2 + 0 kept −3 25 1 new K = + 4 none 0 26 1K − 1 = 4 + 3 + 1 27 1 + 3 − −1 28 1 + 2 + 2 29 1 + 2 − −2 30 1 + 1 + 331 1 + 1 − −3 32 1 − 0 kept 4 33 1 − −4 none 0 34 1 − −3 + 1 35 1 − −3 −−1 36 1 − −2 + 2 37 1 − −2 − −2 38 1 − −1 + 3 39 1 − −1 − −3 40 1 0 kept−4 41 (A(n, K + 1) − U(n, K + 1) − 0 size = kept 5 none 0 42 A(n, K))/2U(n, K) 0 1 + (+) 4 + 1 43 0 U(n − 1, K) + 4 − −1 44 0 U(n − 1, K + 1)3 + 2 45 0 new K 3 − −2 46 0 K = 5 2 + 3 47 0 2 − −3 48 0 1 + 4 49 0 1 −−4 50 0 0 kept 5

Table 8 illustrates index construction examples according to Table 7.

In a further part of the presently presented technology a mixed lowdynamic row-only recursion is described. If the k value is low enough,it is possible to calculate the offset needed for a given row n in theoffset matrix A(n, k) using the new row-only recursion formula presentedfurther below. Detailed derivation of the new recursion formulas aregiven in Appendix B. The generic recursive equation for a given row nfor the PVQ difference offset A(n,k), is used in the 2012 prior artIETF/OPUS-Audio code:

A(n,k)=A(n,k−2)+((2*n−1)*A(n,k−1)−A(n,k−2))/(k−1).

TABLE 8 Example MPVQ(3, 5) Sectioned leading sign enumeration, indexconstruction examples. lead lead index Value p0 sign Value p1 sign Valuep2 Index construction examples 0 5 + 0 none 0 A(3, 0) = 0 1 4 + 1 none 02 4 − 0 kept 1 3 4 − 1 none 0 4 4 + 0 kept 1 5 3 + 2 none 0 6 3 + 1 + 17 3 + 1 − −1 8 3 − 0 kept 2 9 3 − −2 none 0 10 3 − −1 + 1 11 3 − −1 − −112 3 + 0 kept −2 13 2 + 3 none 0 A(3, 3) + 0*(A(3, 4) − (A3, 3))/2 = 1314 2 + 2 + 1 15 2 + 2 − −1 16 2 + 1 + 2 17 2 + 1 − −2 18 2 − 0 kept 3 192 − −3 none 0 A(3, 3) + (A(3, 4) − (A3, 3))/2 = 19 20 2 − −2 + 1 21 2 −−2 − −1 22 2 − −1 + 2 23 2 − −1 − −2 24 2 + 0 kept −3 25 1 + 4 none 0A(3, 4) + 0*(A(3, 5) − (A3, 4))/2 = 25 26 1 + 3 + 1 27 1 + 3 − −1 28 1 +2 + 2 29 1 + 2 − −2 30 1 + 1 + 3 31 1 + 1 − −3 32 1 − 0 kept 4 33 1 − −4none 0 A(3, 4) + (A(3, 5) − (A3, 4))/2 = 33 34 1 − −3 + 1 35 1 − −3 − −136 1 − −2 + 2 37 1 − −2 − −2 38 1 − −1 + 3 39 1 − −1 − −3 40 1 0 kept −441 0 kept 5 none 0 A(3, 5) = 41 42 0 (+) 4 + 1 A(3, 5) + A(2, 1) + 0 =42 43 0 4 − −1 A(3, 5) + A(2, 1) + 1 = 43 44 0 3 + 2 A(3, 5) + A(2, 2) +0 = 44 45 0 3 − −2 A(3, 5) + A(2, 2) + 1 = 45 46 0 2 + 3 A(3, 5) + A(2,3) + 0 = 46 47 0 2 − −3 A(3, 5) + A(2, 3) + 1 = 47 48 0 1 + 4 A(3, 5) +A(2, 4) + 0 = 48 49 0 1 − −4 A(3, 5) + A(2, 4) + 1 = 49 50 0 0 kept 5A(3, 5) + A(2, 5) = 50

By massaging and manipulation the equation above and using the newrelation that

U(n,k)=(A(n,k)−1)/2,

one can obtain a new preferred lower dynamic range mixed recursionformula:

U(n,k)=U(n,k−2)+(n*A(n,k−1)−N _(MPVQ)(n,k−2))/(k−1),

where N_(MPVQ)(n,k)=1+U(n,k)+U(n,k+1), (the MPVQ(n,k) size).

The new numerator term n*A(n, k−1) is here of much lower dynamic rangethan the corresponding prior art numerator term (2*n−1)*A(n,k−1).

In a preferred solution this row-only recursion can be further massagedto only use past A(n,k) values for row n, by using the fact that A(n, k)is odd for k>0. We obtain a new very efficient mixed recursion formula:

U(n,k)=A(n,k−2)>>1+(n*A(n,k−1)−(1+A(n,k−1)>>1+A(n,k−2)>>1))/(k−1),

where “>>” is integer division by 2, a low cost right shift in mosthardware.

This enables the use of fast row-only recursions with limited precision,e.g. within 64 or 32 or 33 bits, for higher n and higher k values thanthe prior art row-only recursion. In other words, the new n*A(n,k−1)term overflows/wraps later than the old term 2*n*A(n,k−1) as oneincreases the range of n's or k's, for the row recursion.

The dynamic benefit of optimized row-only recursion can also be seenindirectly in the reduced dynamic offset Table 2, and also in the mixedrecursion offset Table 3, as the U(n,k) resulting offsets have lowerdynamics than the previously used A(n, k).

In a further part of the presently presented technology a Mixed MPVQleading sign iteration and any legacy PVQ iteration is described.Another possible enumeration alternative is to employ an initialMPVQ-leading sign enumeration stage followed by any other efficientPVQ-enumeration scheme, for the remainder of the vector. In other words,whenever the second leading sign is to be enumerated, thePVQ-enumeration method in use can be switched to a legacy scheme. Theinitial leading sign MPVQ stages will make it possible to use one bitmore than the legacy short codeword scheme, and the initial MPVQ stagewill reduce the dynamics of the offsets (A,U) to at least 1 bit less,after the first MPVQ stage.

Table 99 shows an example deindexing structure and results for MPVQH, ahybrid combination a first MPVQ stage followed by a secondOPUS/IETF-Audio magnitude and (Size PVQ(n,k)=A(n,k)+A(n, k+1)) basedenumeration stage.

TABLE 9 Example MPVQH(3, 5) hybrid single leading sign enumeration. ValVal Val ind Size p0 Size p1 Size p2 Size 0 1 −5 1 1 1 1 0 1 1 1 1 0 1 1U(3, k) + −4 2* 2* 2* 2* −1 3 [p1, p2] section 0 1 2 U(3, k + −4 U(3, k)= U(3, U(3, U(3, 0 where the sub- −1 2 3 1) = −4 2*20 k − 1) = k − 2) =k − 3 = 0 index is encoded 1 4 20 + 30 = −4 2*12 2*6 2*2 1 1 as 0 1 5 50−3 −2 5 PVQ(2, remaining 0 1 6 (This −3 −1 k) sub pyramid −1 2 7 sum −3−1 using any other 1 8 has to −3 0 PVQ scheme, like −2 2 9 be −3 0 theIETF/OPUS- 2 10 below −3 2 3 Audio magnitude 0 1 11 the −3 1 scheme. −12 12 target −3 1 1 13 indexing −2 −3 7 0 1 14 numerical −2 −2 −1 2 15dynamics −2 −2 1 16 e.g. −2 −1 −2 2 17 <2³² or −2 −1 2 18 <2³¹) −2 0 −32 19 −2 0 3 20 −2 3 5 0 1 21 −2 2 −1 2 22 −2 2 1 23 −2 1 −2 2 24 −2 1 225 −1 −4 9 0 1 26 −1 −3 −1 2 27 −1 −3 1 28 −1 −2 −2 2 29 −1 −2 2 30 −1−1 −3 2 31 −1 −1 3 32 −1 0 −4 2 33 −1 0 4 34 −1 4 7 0 1 35 −1 3 −1 2 36−1 3 1 37 −1 2 −2 2 38 −1 2 2 39 −1 1 −3 2 40 −1 1 3 41 0 M(2, k) = −5 11 1 1 0 1 42 0 1 + −4 2*U(2, 2*U(2, 2*U(2, 2*U(2, −1 2 43 0 U(2, −4 k) k− 1) k − 2) k − 3) 1 44 0 k + 1) + −3 M(1, k) −2 2 45 0 U(2, k) = 10 −32 46 0 −2 −3 2 47 0 −2 3 48 0 −1 −4 2 49 0 −1 4 50 0 0 −5 1

MPVQ-variation for (n=3,k=5). This hybrid version uses single leadingsign iterative indexing stage followed by a prior art IETF/OPUS like[{−,0}/+] magnitude based PVQ-indexing stage cells,N_(PVQ)=2*N_(MPVQH)=2*51=102, where the “2” corresponds to a singleinitial single extracted leading sign bit.

The drawback with a hybrid scheme (like the above exemplified MPVQH)using a first MPVQ(n,k) stage and then another pyramid basedPVQ-enumeration stage (above a IETF/OPUS-like magnitude stage) when asecond sign is to be added, is that the PROM code size will be quitemuch larger, and that the switch of indexing method inside the iterationloop will require further decision logic requiring further DSP cyclesinside the critical iteration loops. Also several offsets memories mayhave to be maintained. However a hybrid MPVQ single leading sign stagefollowed by stages of a subsequent regular PVQ scheme can also providethe benefit of extending the total short codeword size by 1 bit, e.g.from 32 to 33 bits.

In the above described embodiments, the leading sign has been selectedas the sign of the first non-zero coefficient in the vector. However, inother embodiments, the leading sign can also be selected as the lastnon-zero coefficient in the vector. The leading sign is thus a sign of aterminal non-zero coefficient in the integer input vector or the integeroutput vector. The terminal non-zero coefficient is one of a firstnon-zero coefficient and a last non-zero coefficient in the integerinput vector or the integer output vector. The use of extracting theleading sign is that the remaining indexing can be simplified. Oneprominent reason is that the indexing scheme can reduced by a factor 2.Before the indexing, it is not known how many non-zero coefficientsthere are in the vector to be treated. However, there is always aterminal non-zero coefficient.

In the above described embodiments, it has also been assumed that theindexing of the integer input vector starts from the last coefficientand ends with the first coefficient, and that the de-indexing startswith the first coefficient of the integer output vector and ends withthe last. In alternative embodiments, the indexing may instead startwith the first vector coefficient and end with the last, whereas thede-indexing starts with the last coefficient and ends with the first.This can be combined with any of the alternative of the terminalnon-zero coefficients. In further embodiments, the indexing may pick thecoefficients of the integer input vector in any predetermined order, andthe corresponding de-indexing then goes through the coefficients of theinteger output vector in the opposite direction. The pyramid vectorquantization enumeration scheme and the pyramid vector quantizationde-enumeration scheme may then be adapted accordingly. In one particularembodiment, the “position” in the integer input/output vector can be aposition in the assumed treatment order and do not have to correspond tothe actual position within the vector itself.

The proposed technology may in particular embodiments be applied to auser terminal or user equipment, which may be a wired or wirelessdevice.

As used herein, the non-limiting terms “User Equipment” (UE) and“wireless device” may refer to a mobile phone, a cellular phone, aPersonal Digital Assistant, PDA, equipped with radio communicationcapabilities, a smart phone, a laptop or Personal Computer (PC) equippedwith an internal or external mobile broadband modem, a tablet PC withradio communication capabilities, a target device, a device to deviceUE, a machine type UE or UE capable of machine to machine communication,iPAD, Customer Premises Equipment (CPE), Laptop Embedded Equipment(LEE), Laptop Mounted Equipment (LME), Universal Serial Bus (USB)dongle, a portable electronic radio communication device, a sensordevice equipped with radio communication capabilities or the like. Inparticular, the term “UE” and the term “wireless device” should beinterpreted as non-limiting terms comprising any type of wireless devicecommunicating with a radio network node in a cellular or mobilecommunication system or any device equipped with radio circuitry forwireless communication according to any relevant standard forcommunication within a cellular or mobile communication system.

As used herein, the term “wired device” may refer to any deviceconfigured or prepared for wired connection to a network. In particular,the wired device may be at least some of the above devices, with orwithout radio communication capability, when configured for wiredconnection.

The proposed technology may in particular embodiments be applied to anetwork node, which may be a wired or wireless device.

The network node can in particular embodiments be a radio network node.As used herein, the non-limiting term “radio network node” may refer tobase stations, network control nodes such as network controllers, radionetwork controllers, base station controllers, and the like. Inparticular, the term “base station” may encompass different types ofradio base stations including standardized base stations such as NodeBs, or evolved Node Bs, eNBs, and also macro/micro/pico radio basestations, home base stations, also known as femto base stations, relaynodes, repeaters, radio access points, base transceiver stations, BTSs,and even radio control nodes controlling one or more Remote Radio Units,RRUs, or the like.

The network node can in particular embodiments be a network node in awired communication system.

The UE or network node may also include radio circuitry forcommunication with one or more other nodes, including transmittingand/or receiving information.

It will be appreciated that the methods and devices described herein canbe combined and re-arranged in a variety of ways.

For example, embodiments may be implemented in hardware, or in softwarefor execution by suitable processing circuitry, or a combinationthereof.

The steps, functions, procedures, modules and/or blocks described hereinmay be implemented in hardware using any conventional technology, suchas discrete circuit or integrated circuit technology, including bothgeneral-purpose electronic circuitry and application-specific circuitry.

Particular examples include one or more suitably configured digitalsignal processors and other known electronic circuits, e.g. discretelogic gates interconnected to perform a specialized function, orApplication Specific Integrated Circuits (ASICs).

Alternatively, at least some of the steps, functions, procedures,modules and/or blocks described herein may be implemented in softwaresuch as a computer program for execution by suitable processingcircuitry such as one or more processors or processing units.

The flow diagram or diagrams presented herein may therefore be regardedas a computer flow diagram or diagrams, when performed by one or moreprocessors. A corresponding apparatus may be defined as a group offunction modules, where each step performed by the processor correspondsto a function module. In this case, the function modules are implementedas a computer program running on the processor.

Examples of processing circuitry includes, but is not limited to, one ormore microprocessors, one or more Digital Signal Processors, DSPs, oneor more Central Processing Units, CPUs, video acceleration hardware,and/or any suitable programmable logic circuitry such as one or moreField Programmable Gate Arrays, FPGAs, or one or more Programmable LogicControllers, PLCs.

It should also be understood that it may be possible to re-use thegeneral processing capabilities of any conventional device or unit inwhich the proposed technology is implemented. It may also be possible tore-use existing software, e.g. by reprogramming of the existing softwareor by adding new software components.

The proposed technology provides an encoder configured to encodeaudio/video signals, wherein the encoder is configured to obtain aninteger input vector representing audio/video signal samples, whichinteger input vector has a number of integer-valued coefficients,extract a leading sign from said integer input vector, said leading signbeing a sign of a terminal non-zero coefficient in the input vector,said terminal non-zero coefficient being one of a first non-zerocoefficient and a last non-zero coefficient in the integer input vector,index said integer input vector with a pyramid vector quantizationenumeration scheme into an output index, which output index togetherwith said leading sign representing audio/video signal samples, whereinthe pyramid vector quantization enumeration scheme is designed forneglecting the sign of the terminal non-zero coefficient, and to outputthe leading sign as a first codeword and the output index as a secondcodeword into an outgoing bit stream.

In a particular example, the encoder comprises a processor and a memory.The memory comprising instructions executable by the processor, wherebythe encoder/processor is operative to obtain an integer input vectorrepresenting audio/video signal samples, which integer input vector hasa number of integer-valued coefficients, extract a leading sign fromsaid integer input vector, said leading sign being a sign of a terminalnon-zero coefficient in the input vector, said terminal non-zerocoefficient being one of a first non-zero coefficient and a lastnon-zero coefficient in the integer input vector, index said integerinput vector with a pyramid vector quantization enumeration scheme intoan output index, which output index together with the leading signrepresenting audio/video signal samples, wherein the pyramid vectorquantization enumeration scheme is designed for neglecting the sign ofthe terminal non-zero coefficient, and to output the leading sign as afirst codeword and the output index as a second codeword into anoutgoing bit stream.

The proposed technology also provides a decoder configured deindex intoaudio/video samples by pyramid vector quantization, wherein the decoderis configured to receive a leading sign as a first codeword and an inputindex as a second codeword from an ingoing bit stream, the leading signand the input index representing audio/video signal samples, whichleading sign is a sign of a terminal non-zero coefficient in an integeroutput vector to be created, representing the audio/video signalsamples, which integer output vector has a number of integer-valuedcoefficients, which terminal non-zero coefficient is one of a firstnon-zero coefficient and a last non-zero coefficient in the integeroutput vector, deindex the input index into the integer output vectorwith a pyramid vector quantization de-enumeration scheme, wherein theinput index being created by an enumeration scheme is designed forneglecting the sign of the terminal non-zero coefficient, assign a signof the terminating non-zero coefficient according to the receivedleading sign, and to output the vector.

In a particular example, the decoder comprises a processor and a memory.The memory comprising instructions executable by the processor, wherebythe decoder/processor is operative to receive a leading sign as a firstcodeword and an input index as a second codeword from an ingoing bitstream, the leading sign and the input index representing audio/videosignal samples, which leading sign is a sign of a terminal non-zerocoefficient in an integer output vector to be created, representing theaudio/video signal samples, which integer output vector has a number ofinteger-valued coefficients, which terminal non-zero coefficient is oneof a first non-zero coefficient and a last non-zero coefficient in theinteger output vector, deindex the input index into the integer outputvector with a pyramid vector quantization de-enumeration scheme, whereinthe input index being created by an enumeration scheme is designed forneglecting the sign of the terminal non-zero coefficient, assign a signof the terminating non-zero coefficient according to the receivedleading sign, and to output the vector

In the following, an example of a computer implementation will bedescribed with reference to FIG. 20. The encoder 10 comprises processingcircuitry such as one or more processors 800 and a memory 810. In thisparticular example, at least some of the steps, functions, procedures,modules and/or blocks described herein are implemented in a computerprogram 820-826, which is loaded into the memory for execution by theprocessing circuitry. The processing circuitry and memory areinterconnected to each other to enable normal software execution. Anoptional input/output 804-808 device may also be interconnected to theprocessing circuitry and/or the memory to enable input and/or output ofrelevant data such as input parameter(s) and/or resulting outputparameter(s).

In the following, another example of a computer implementation will bedescribed with reference to FIG. 21. The decoder 60 comprises processingcircuitry such as one or more processors 850 and a memory 860. In thisparticular example, at least some of the steps, functions, procedures,modules and/or blocks described herein are implemented in a computerprogram 870-876, which is loaded into the memory for execution by theprocessing circuitry. The processing circuitry and memory areinterconnected to each other to enable normal software execution. Anoptional input/output device 854-858 may also be interconnected to theprocessing circuitry and/or the memory to enable input and/or output ofrelevant data such as input parameter(s) and/or resulting outputparameter(s).

The term ‘computer’ should be interpreted in a general sense as anysystem or device capable of executing program code or computer programinstructions to perform a particular processing, determining orcomputing task.

In a particular embodiment, the computer program comprises instructions,which when executed by at least one processor, cause the processor(s) toobtain an integer input vector representing said audio/video signalsamples, which integer input vector has a number of integer-valuedcoefficients, to extract a leading sign from the integer input vector,which leading sign is a sign of a terminal non-zero coefficient in theinteger input vector, which terminal non-zero coefficient is one of afirst non-zero coefficient and a last non-zero coefficient in theinteger input vector, to index the integer input vector with a pyramidvector quantization enumeration scheme into an output index, whichoutput index together with the leading sign representing the audio/videosignal samples, which pyramid vector quantization enumeration schemeneglecting the sign of the terminal non-zero coefficient, and to outputthe leading sign as a first codeword and the output index as a secondcodeword into an outgoing bit stream.

In a particular embodiment, the computer program comprises instructions,which when executed by at least one processor, cause the processor(s) toreceive a leading sign as a first codeword and an input index as asecond codeword from an ingoing bit stream, where the leading sign andthe input index represent audio/video signal samples, which leading signis a sign of a terminal non-zero coefficient in an integer output vectorto be created, representing the audio/video signal samples, whichinteger output vector has a number of integer-valued coefficients, whichterminal non-zero coefficient is one of a first non-zero coefficient anda last non-zero coefficient in the integer output vector, to deindex theinput index into the integer output vector with a pyramid vectorquantization de-enumeration scheme, which input index is created by anenumeration scheme neglecting the sign of said terminal non-zerocoefficient, to assigning a sign of the terminating non-zero coefficientaccording to the received leading sign, and to output the integer outputvector.

The proposed technology also provides a carrier comprising the computerprogram, wherein the carrier is one of an electronic signal, an opticalsignal, an electromagnetic signal, a magnetic signal, an electricsignal, a radio signal, a microwave signal, or a computer-readablestorage medium.

The software or computer program may thus be realized as a computerprogram product, which is normally carried or stored on acomputer-readable medium. The computer-readable medium may include oneor more removable or non-removable memory devices including, but notlimited to a Read-Only Memory, ROM, a Random Access Memory, RAM, aCompact Disc, CD, a Digital Versatile Disc, DVD, a Blueray disc, aUniversal Serial Bus, USB, memory, a Hard Disk Drive, HDD storagedevice, a flash memory, a magnetic tape, or any other conventionalmemory device. The computer program may thus be loaded into theoperating memory of a computer or equivalent processing device forexecution by the processing circuitry thereof.

As indicated herein, the encoder may alternatively be defined as a groupof function modules, where the function modules are implemented as acomputer program running on at least one processor.

FIG. 22 is a schematic block diagram illustrating an example of anencoder 10 comprising a group of function modules 830-836.

The computer program residing in memory 810 may thus be organized asappropriate function modules 830-836 configured to perform, whenexecuted by the processor 800, at least part of the steps and/or tasksdescribed herein. An example of such function modules 830-836 isillustrated in FIG. 22.

As indicated herein, the decoder may alternatively be defined as a groupof function modules, where the function modules are implemented as acomputer program running on at least one processor.

FIG. 23 is a schematic block diagram illustrating an example of adecoder 60 comprising a group of function modules 880-886.

The computer program residing in memory 860 may thus be organized asappropriate function modules 880-886 configured to perform, whenexecuted by the processor 850, at least part of the steps and/or tasksdescribed herein. An example of such function modules 880-886 isillustrated in FIG. 23.

The proposed approaches improves the performance of a short codewordbased pyramid vector quantization schemes. The scheme reduces thedynamic range of the required indexing offsets. The desired side effectof the reduced dynamic range is that 1-bit larger ‘short’ PVQ-codewordscan be used, without any significant penalty, for a given HW.

This makes it possible to use B+1 bit PVQ-codeword scheme on DSPhardware supporting B bit unsigned arithmetic, and this makes itpossible to implement a B bit PVQ-codeword scheme on a DSP hardwarewhich only supports signed B-bit integer arithmetic (with a B−1 bitmagnitude).

Further, the overhead required for transmitting splitting sideinformation will be reduced due to the capability of efficientlyencoding 1-bit larger codewords. As an example is used, PVQ-encoding ofk evenly distributed pulses in dimension N=128, where 5 bits is used toencode the relation for each binary dimension split and 71 bits wereallocated to the PVQ over dimension N=128 by the audio codecbit-allocation algorithm.

Optimal unrestricted PVQ gives:

log 2(N _(PVQ)(N=128,k=12))=67.2 bits,

log 2(N _(MPVQ)(N=128,k=12+1))=71.5 bits.

67.2<71<71.5, i.e. 12 unit pulses are possible using an optimalunlimited PVQ over N=128, resulting in a pulse density of 12/128.

Legacy B=32 bit scheme requires 2 splits, into nearly equal dimensions[N1=43, N2=43, N3=42]):

2*log 2(N _(PVQ)(43,4))+log 2(N _(PVQ)(42,4))+2*5=63.25+2*5=73.25 bits

73.25 is over the bit budget 71. By trying to reduce number of pulses by1 to 11, one obtains:

2*log 2(N _(PVQ)(43,4))+log 2(N _(PVQ)(42,3))+2*5=58.84+2*5=68.84 5<71.

Resulting pulse density becomes 11/128.

Legacy B=32 bit scheme requires 2 splits, into non-uniform splitdimensions [N1=64, N2=32, N3=32]):

log 2(N _(PVQ)(64,6))+2*log 2(N _(PVQ)(32,3))+2*5=53.34+2*5=73.34bits

73.25 is over the bit budget 71. By trying to reduce number of pulses by1 to 11, one obtains:

2*log 2(N _(PVQ)(32,3))+log 2(N _(PVQ)(64,5))+2*5=58.92+2*5=68.9<71.

Resulting pulse density becomes 11/128.

New (B+1)=33-bit MPVQ scheme requires one split into [N1=64,N2=64]):

2*log 2(2*N _(MPVQ)(64,6))+5=2*32.51+5=70.02 bits<71,

where

2*N _(MPVQ)(64,6)=N _(PVQ)(64,6)=32.51>B.

Resulting pulse density becomes 12/128. In other words, given 71 bitsallocated to dimension N=128 vector, the old 32 bit codeword scheme canonly provide 11 pulses, while the new 33-bit codeword scheme can provide12 pulses.

Due to its 1-bit larger encoding range of 33-bits, the new scheme isbetter suited to allocate bits according the audio codec's original bitallocation instructions, as the overhead for additional vectorssplitting (often) may be reduced.

An example audio codec bit allocation scheme can be found in the ITU-TG.719 specification, section 7.5.2 or OPUUS RFC6716, section 4.3.4.1.

The embodiments described above are merely given as examples, and itshould be understood that the proposed technology is not limitedthereto. It will be understood by those skilled in the art that variousmodifications, combinations and changes may be made to the embodimentswithout departing from the present scope as defined by the appendedclaims. In particular, different part solutions in the differentembodiments can be combined in other configurations, where technicallypossible.

Abbreviations

-   VQ Vector Quantizer/Quantization-   PVQ Pyramid VQ-   PVQ(n,k) The PVQ structure with dimension n and k unit pulses, the    PVQ(n,k) is pyramid structure with an L1-norm equaling k.-   MPVQ leading sign Modular PVQ-   MPVQ(n,k) The MPVQ structure with dimension n and k unit pulses, the    MPVQ(n,k) structure is a sliced PVQ(n,k) pyramid structure, the    L1-norm of MPVQ(n,k) is k.-   N_(PVQ)(N,K) Size of PVQ (dimension N, K unit pulses)-   N_(MPVQ)(N,K) Size of MPVQ (dimension N, K unit pulses)-   SIMD Single Instruction Multiple Data (a DSP instruction category)-   DSP Digital Signal Processor-   HW HardWare-   SW SoftWare-   N,dim Dimension-   n, l current dimension-   k, K number of unit pulses in PVQ(n, k) and in MPVQ(n,k)-   KMAX maximum K-value-   B bit-limit in the target hardware system for efficient operations,    typically (16), 32 or 64 bits in today's processors.-   R bits per sample, or bits per coefficient,-   x target vector-   r, vec shape vector (also sometimes called residual)-   G gain (scalar or vector) for scaling target vector-   RAM Random Access Memory-   OPS Operations Per Second-   MOPS Million Operations Per Second-   P-ROM Program ROM-   ROM Read-Only Memory (typically pre-stored data)-   LSB Least Significant Bit-   MSB Most Significant Bit-   LP Linear Prediction

APPENDIX A

In this appendix, relevant extracts from the IETF/OPUS audioPVQ-sections are included to establish the prior art status. The refinedand optimized OPUS-Audio PVQ indexing/de-indexing algorithm involveseveral optimizations which are not described in the text description ofRFC 6716 but is provided as a c-code file (cwrs.c) in an attachmentIETF/OPUS-Audio RFC6716 PVQ-deindexing

“PVQ Decoding

Decoding of PVQ vectors is implemented in decode_pulses( )(cwrs.c). Theunique codeword index is decoded as a uniformly distributed integervalue between 0 and V(N,K)−1, where V(N,K) is the number of possiblecombinations of K pulses in N samples. The index is then converted to avector in the same way specified in [PVQ]. The indexing is based on thecalculation of V(N,K) (denoted N(L,K) in [PVQ]).

The number of combinations can be computed recursively asV(N,K)=V(N−1,K)+V(N,K−1)+V(N−1,K−1), with V(N,0)=1 and V(0,K)=0, K!=0.There are many different ways to compute V(N,K), including precomputedtables and direct use of the recursive formulation. The referenceimplementation applies the recursive formulation one line (or column) ata time to save on memory use, along with an alternate, univariaterecurrence to initialize an arbitrary line, and direct polynomialsolutions for small N. All of these methods are equivalent, and havedifferent trade-offs in speed, memory usage, and code size.Implementations MAY use any methods they like, as long as they areequivalent to the mathematical definition.

The decoded vector X is recovered as follows. Let i be the index decodedwith the procedure in Section 4.1.5 with ft=V(N,K), so that 0<=i<V(N,K).Let k=K. Then, for j=0 to (N−1), inclusive, do:

-   -   1. Let p=(V(N−j−1,k)+V(N−j,k))/2.    -   2. If i<p, then let sgn=1, else let sgn=−1 and set i=i−p.    -   3. Let k0=k and set p=p−V(N−j−1,k).    -   4. While p>i, set k=k−1 and p=p−V(N−j−1,k).    -   5. Set X[j]=sgn*(k0−k) and i=i−p.

The decoded vector X is then normalized such that its L2-norm equalsone.”

IETF/OPUS-Audio PVQ Codeword Limit and Splitting

“Split Decoding

To avoid the need for multi-precision calculations when decoding PVQcodevectors, the maximum size allowed for codebooks is 32 bits. Whenlarger codebooks are needed, the vector is instead split in twosub-vectors of size N/2. A quantized gain parameter with precisionderived from the current allocation is entropy coded to represent therelative gains of each side of the split, and the entire decodingprocess is recursively applied. Multiple levels of splitting may beapplied up to a limit of LM+1 splits. The same recursive mechanism isapplied for the joint coding of stereo audio.”

IETF/OPUS Audio RFC-6716 PVQ Search

“Spherical Vector Quantization

CELT uses a Pyramid Vector Quantizer (PVQ) [PVQ] for quantizing thedetails of the spectrum in each band that have not been predicted by thepitch predictor. The PVQ codebook consists of all sums of K signedpulses in a vector of N samples, where two pulses at the same positionare required to have the same sign. Thus, the codebook includes allinteger codevectors y of N dimensions that satisfy sum(abs(y(j)))=K.

In bands where there are sufficient bits allocated, PVQ is used toencode the unit vector that results from the normalization in Section5.3.2 directly. Given a PVQ codevector y, the unit vector X is obtainedas X=y/∥y∥, where ∥·∥ denotes the L2 norm.”

“PVQ Search

The search for the best codevector y is performed by alg_quant( )(vq·c).There are several possible approaches to the search, with a trade-offbetween quality and complexity. The method used in the referenceimplementation computes an initial codeword y1 by projecting thenormalized spectrum X onto the codebook pyramid of K−1 pulses:

y0=truncate_towards_zero((K−1)*X/sum(abs(X)))

Depending on N, K and the input data, the initial codeword y0 maycontain from 0 to K−1 non-zero values. All the remaining pulses, withthe exception of the last one, are found iteratively with a greedysearch that minimizes the normalized correlation between y and X:

$\begin{matrix}T \\{J = {{- X}*{y/{y}}}}\end{matrix}$

The search described above is considered to be a good trade-off betweenquality and computational cost. However, there are other possible waysto search the PVQ codebook and the implementers MAY use any other searchmethods. See alg_quant( ) in celt/vq·c.”

IETF/OPUS Audio RFC-6716 PVQ-Indexing

“PVQ Encoding

The vector to encode, X, is converted into an index i such that0<=i<V(N,K) as follows. Let i=0 and k=0. Then, for j=(N−1) down to 0,inclusive, do:

-   -   1. If k>0, set i=i+(V(N−j−1,k−1)+V(N−j,k−1))/2.    -   2. Set k=k+abs(X[j]).    -   3. If X[j]<0, set i=i+(V(N−j−1,k)+V(N−j,k))/2.

The index i is then encoded using the procedure in Section 5.1.4 withft=V(N,K).”

APPENDIX B

Derivation of the MPVQ Related Recursion Equations

Derivation of the U(n,k) and M(n, k)=N_(MPVQ)(n, k) size relation usingFischer's formula:

Use N(n,k) as a short notation for N_(PVQ)(n,k), the number ofPVQ-vectors for dimension n with k unit pulses.

Fischer's original PVQ recursion from 1986:

N(n,k)=N(n−1,k)+N(n−1,k−1)+N(n−1,k)  (1)

Define M(n,k)=N(n,k)/2;  (2)

-   -   M(n,k) is used below as short notation for N_(MPVQ)(n,k)        -   // M(n,k) number of PVQ-vectors with an positive initial        -   // sign, is half the number of entries in a full PVQ-        -   // pyramid N(n,k))

Define U(n,k) as sum(j=1,j=k−1,M(n−1,j)  (3)

-   -   // the number of vectors with a remaining leading    -   //+(positive) sign, excluding the vectors with an    -   // initial position value of ‘k’ and excluding the    -   // vectors an initial position value of ‘0’

M(n,k)=1+2*U(n,k)+M(n−1,k);  (4)

-   -   // 1 for k=KMAX, only one such leading vector possible    -   // 2*U(n,k) for the number of vectors with a new/next leading    -   // sign, (“2” due to positive or negative new/next leading    -   // sign) (the “(U(n,k)” vectors have initial positive    -   // amplitudes [KMAX−1, KMAX−2 . . . 1]) M(n−1,k) for remaining    -   // with vectors a leading zero value

(Equivalently with M(n,k)=N_(MPVQ)(n,k))

N _(MPVQ)(n,k)=1+2*U(n,k)N _(MPVQ)(n−1,k);(4b)

M(n,k)−M(n−1,k)=1+2*U(n,k)=A(n,k)  (5)

Combine (1) (2) (5)

M(n−1,k)=U(n,k+1)−U(n,k)  (6)

Combine (4) (6)

M(n,k)=1+U(n,k)+U(n,k+1)  (7)

(7) can now be used for size calculation, as both U(n,k) andU(n,k+1)<M(n,k) (5) the difference (5), A(n, k), can still be used foramplitude offset iterations, if only used for offsets up to A(n, KMAX),as A(n,KMAX+1), may exceed M(n, KMAX), and thus causing numeric problemsin precision limited hardware Derivation of direct row calculationrecursion for U(n,k)

U(n,k)=(A(n,k)−1)/2  (from eq (5))

Generic equation for a PVQ difference row A(n,k), used inCELT/OPUS-Audio

A(n,k)=A(n,k−2)+((2*n−1)*A(n,k−1)−A(n,k−2))/(k−1)   (8)

Combine (5) (8)

U(n,k)=((2*n−1)*(U(n,k−1)+(k−2)*U(n,k−2)+n−1)/(k−1)  (9)

Or allow a mixed recursion

U(n,k)=(A(n,k−2)−1)/2+((2*n−1)*A(n,k−1)−A(n,k−2))/(2*(k−1))  (10)

Due to the high dynamic range of the numerator of (8 and 9, 10), specialcare has to be taken when evaluating this direct function, esp. in alimited precision arithmetic system (e.g. a 32 bit system).

(8) is used in IETF/OPUS, and original-CELT

(10) can be used in the MPVQ system calculation of U(n,KMAX+1), as it isknown apriori that all previous A(n, k<KMAX+1) have low enough values.

(10) can be simplified even further (as A(n,k) is always odd for k>1)

U(n,k)=floor(A(n,k−2)/2)+(n*A(n,k−1)−(floor(A(n,k−1)/2)+floor(A(n,k−2)/2+1)))/(k−1)  (11)

or U(n,k)=U(n,k−2)+(n*A(n,k−1)−N _(MPVQ)(n,k−2))/(k−1)   (11.b)

MPVQ n,k-Matrix Recursion Relations

From Fischer relation (1) N(n, k)=N(n−1,k)+N(n−1,k−1)+N(n−1,k)

Combine (7) and (5) one can find these recursive relations:

U(n,k+1)=1+U(n−1,k)+U(n−1,k+1)+U(n,k)   (12),

-   -   with initial conditions

U(0,*)=0,U(1,*)=0, and U(a,b)=U(b,a)

A(n,k+1)=A(n−1,k)+A(n−1,k+1)+A(n,k)  (13)

-   -   with initial conditions A(0,0)=1, A(0,1+)=0, A(1,*)=1, and        A(a,b)=A(b,a)

(13) can now be used to iteratively calculate row n, k=0:KMAX fromprevious vector row n−1,k=0:KMAX for A(n,k), and (12) be used toiteratively calculate row n, k=0:KMAX+1 from previous vector rown−1,k=0:KMAX+1 for U(n,k).

(13) is used in IETF-OPUS-Audio

Using (12) and the fact that A(n,k) is odd, we obtain a new efficientmixed recursion formula:

U(n,k+1)=1+A(n−1,k)>>1+U(n−1,k+1)+A(n,k)>>1   (14),

-   -   where “>>” is integer division by 2 (a right shift), as A(large        n,k+1) may saturate, Equation 14 is used to stay within the        given dynamic range e.g (32 bits, for the last (k+1) offset        column.

The Vector Radius Relation, Enumeration by Products and Vector LengthRecursion Relations

Hung, Tsern, Meng 1998 also summarizes some relevant additionalrelations for a PVQ(1==n, k) pyramid the size is N(l, k)=N_(PVQ)(l, k),The vector radius recursive relation“(43)” below is a basic row-onlysize relation for row 1=n.

The enumeration formula by products “(44)” below is a number of non-zeroelements based product relation for the PVQ size.

$\begin{matrix}{{{\left( {l - 1} \right){N\left( {l,k} \right)}} = {{2{{kN}\left( {{l - 1},k} \right)}} + {\left( {l - 1} \right){N\left( {{l - 2},k} \right)}}}}{{Vector}\mspace{14mu} {length}\mspace{14mu} {recursion}}} & (42) \\{{{{kN}\left( {l,k} \right)} = {{2{{lN}\left( {l,{k - 1}} \right)}} + {\left( {k - 2} \right){N\left( {l,{k - 2}} \right)}}}}{{Vector}\mspace{14mu} {radius}\mspace{14mu} {recursion}}} & (43) \\{{{N\left( {l,k} \right)} = {\sum\limits_{s}{2^{s}\begin{pmatrix}l \\s\end{pmatrix}\begin{pmatrix}{k - 1} \\{s - 1}\end{pmatrix}}}}{{Enumeration}\mspace{14mu} {formula}\mspace{14mu} {by}\mspace{14mu} {products}}} & (44)\end{matrix}$

1. A method for pyramid vector quantization indexing of audio/videosamples, wherein said method comprises the steps of: obtaining aninteger input vector; said integer input vector representing saidaudio/video signal samples; said integer input vector having a number ofinteger-valued coefficients; extracting a leading sign from said integerinput vector; said leading sign being a sign of a last non-zerocoefficient in said integer input vector in a direction of encoding;indexing said integer input vector with a modified pyramid vectorquantization enumeration scheme into an output index, which output indextogether with said leading sign representing said audio/video signalsamples; said modified pyramid vector quantization enumeration schemeneglecting said leading sign by shifting a sign of each non-zerocoefficient such that said shifted sign is encoded in association withnext non-zero coefficient in the direction of encoding; and outputtingsaid leading sign as a first codeword and said output index as a secondcodeword into an outgoing bit stream.
 2. The method according to claim1, wherein said step of indexing is performed by an iterativeenumeration procedure; wherein said iterative enumeration procedurecomprises repetition of an iteration step, in which one currentcoefficient of said integer input vector is selected for consideration;said iteration step in turn comprising: finding an offset parameterbeing associated with all coefficients of said integer input vectorprocessed prior to said current coefficient of said integer inputvector; and increasing an accumulated index in dependence of said offsetparameter; wherein said repetition is continued with coefficients ofsaid integer input vector being selected one after the other as saidcurrent coefficient at least until all coefficients in said integerinput vector has been considered; said iterative enumeration procedurecomprising a terminating step in which said output index is set equal tosaid accumulated index after all iteration steps have been ended.
 3. Themethod according to claim 2, wherein said increasing of said accumulatedindex in each iteration step is given a least significant bit independence of a sign of a previous non zero coefficient in said integerinput vector.
 4. The method according to claim 2, wherein saidincreasing of said accumulated index is based at least partly on a firstoffset parameter U(n,k), where n is the dimension of the integer inputvector and k is the number of unit pulses, said first offset parameterU(n,k) being defined as the number of integer vectors of dimension n andL1-norm of k, that does not have a leading zero, and does not have theleading value k, has a leading positive value, and has a positive nextleading sign.
 5. The method according to claim 2, wherein saidincreasing of said index is based at least partly on a second offsetparameter A(n,k), where n is the dimension of the integer input vectorand k is the number of unit pulses, said second offset parameter A(n,k)being defined as the number of integer vectors of dimension n andL1-norm of k, that has a positive leading value and that does not have aleading zero.
 6. A method for pyramid vector quantization deindexing ofaudio/video samples, wherein said method comprises the steps of:receiving a leading sign as a first codeword and an input index as asecond codeword from an ingoing bit stream; said leading sign and saidinput index representing audio/video signal samples; said leading signbeing a sign of a terminal non-zero coefficient in an integer outputvector to be created, representing said audio/video signal samples; saidinteger output vector having a number of integer-valued coefficients;said terminal non-zero coefficient being a first non-zero coefficient insaid integer output vector; deindexing said input index into saidinteger output vector with a modified pyramid vector quantizationde-enumeration scheme; said input index being created by an enumerationscheme neglecting said sign of said terminal non-zero coefficient;assigning a sign of said terminal non-zero coefficient in said integeroutput vector according to said received leading sign; and outputtingsaid integer output vector.
 7. The method according to claim 6, whereinsaid step of deindexing is performed by an iterative de-enumerationprocedure; wherein said iterative de-enumeration procedure comprises aninitializing step, in which a remaining index is set equal to said inputindex, and a repetition of an iteration step, in which one currentcoefficient of said integer output vector is selected for consideration;said iteration step comprises: finding an offset parameter beingcompatible with a position of said current coefficient within saidinteger output vector and with said remaining index; reducing saidremaining index in dependence of said offset parameter; and setting anamplitude of said current coefficient of said integer input vector to beequal to an amplitude associated with said offset parameter; whereinsaid repetition is continued with coefficients of said integer inputvector being selected one after the other as said current coefficient atleast until said remaining index becomes equal to zero.
 8. The methodaccording to claim 7, wherein a sign of a next non zero coefficient insaid integer input vector is deduced in dependence of a leastsignificant bit in said remaining index.
 9. The method according toclaim 7, wherein said reduction of said remaining index is based atleast partly on a first offset parameter U(n,k), where n is thedimension of the integer input vector and k is the number of unitpulses, said first offset parameter U(n,k) being defined as the numberof integer vectors of dimension n and L1-norm of k, that does not have aleading zero, and does not have the leading value k, has a leadingpositive value, and has a positive next leading sign.
 10. The methodaccording to claim 7, wherein said reduction of said remaining index isbased at least partly on a second offset parameter A(n,k), where n isthe dimension of the integer input vector and k is the number of unitpulses, said second offset parameter A(n,k) being defined as the numberof integer vectors of dimension n and L1-norm of k, that has a positiveleading value and that does not have a leading zero.
 11. An encoderconfigured to index audio/video samples by pyramid vector quantization,wherein said encoder is configured to obtain an integer input vector;said integer input vector representing said audio/video signal samples,said integer input vector having a number of integer-valuedcoefficients; wherein said encoder is configured to extract a leadingsign from said integer input vector; said leading sign being a sign of alast non-zero coefficient in said integer input vector in a direction ofencoding; wherein said encoder is configured to index said integer inputvector with a modified pyramid vector quantization enumeration schemeinto an output index, which output index together with said leading signrepresenting said audio/video signal samples; said modified pyramidvector quantization enumeration scheme neglecting said leading sign byshifting a sign of each non-zero coefficient such that said shifted signis encoded in association with next non-zero coefficient in thedirection of encoding; and wherein said encoder is configured to outputsaid leading sign as a first codeword and said output index as a secondcodeword into an outgoing bit stream.
 12. The encoder according to theclaim 11, wherein said encoder is configured to perform said indexing byan iterative enumeration procedure; wherein said iterative enumerationprocedure comprises repetition of an iteration step, in which onecurrent coefficient of said integer input vector is selected forconsideration; said iteration step comprising: finding an offsetparameter being associated with all coefficients of said integer inputvector processed prior to said current coefficient of said integer inputvector; and increasing an accumulated index in dependence of said offsetparameter; wherein said repetition is continued with coefficients ofsaid integer input vector being selected one after the other as saidcurrent coefficient at least until all coefficients in said integerinput vector has been considered; said iterative enumeration procedurecomprising a terminating step in which said output index is set equal tosaid accumulated index after all iteration steps have been ended. 13.The encoder according to claim 12, wherein said increasing of saidaccumulated index in each iteration step is given a least significantbit in dependence of a sign of a previous non zero coefficient in saidinteger input vector.
 14. A decoder configured to deindex intoaudio/video samples by pyramid vector quantization, wherein said decoderis configured to receive a leading sign as a first codeword and an inputindex as a second codeword from an ingoing bit stream; said leading signand said input index representing audio/video signal samples saidleading sign being a sign of a terminal non-zero coefficient in aninteger output vector to be created, representing said audio/videosignal samples; said integer output vector having a number ofinteger-valued coefficients; said terminal non-zero coefficient being afirst non-zero coefficient in said integer output vector; wherein saiddecoder is configured to deindex said input index into said integeroutput vector with a modified pyramid vector quantization de-enumerationscheme; said input index being created by an enumeration schemeneglecting said sign of said terminal non-zero coefficient; wherein saiddecoder is configured to assign a sign of said terminating non-zerocoefficient according to said received leading sign; and wherein saiddecoder is configured to output said integer output vector.
 15. Thedecoder according to claim 14, wherein said decoder is configured toperform said deindexing by an iterative de-enumeration procedure;wherein said iterative de-enumeration procedure comprises aninitializing step, in which a remaining index is set equal to said inputindex, and a repetition of an iteration step, in which one currentcoefficient of said integer output vector is selected for consideration;said iteration step comprises: finding an offset parameter beingcompatible with a position of said current coefficient within saidinteger output vector and with said remaining index; reducing saidremaining index in dependence of said offset parameter; and setting anamplitude of said current coefficient of said integer input vector to beequal to an amplitude associated with said offset parameter; whereinsaid repetition is continued with coefficients of said integer inputvector being selected one after the other as said current coefficient atleast until said remaining index becomes equal to zero.
 16. The decoderaccording to claim 15, wherein a sign of a next non zero coefficient insaid integer input vector is deduced in dependence of a leastsignificant bit in said remaining index.